]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/stc/stc.cpp
Don't create a bitmap with dimensions <= 0...
[wxWidgets.git] / contrib / src / stc / stc.cpp
index ba9cf82838cd84df4f5dd2f95462083621a67674..711ff34390276d716a03326352a130f321decabf 100644 (file)
@@ -137,6 +137,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
 {
     m_swx = new ScintillaWX(this);
     m_stopWatch.Start();
+    m_lastKeyDownConsumed = FALSE;
 }
 
 
@@ -1833,42 +1834,39 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
 
 void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
     long key = evt.KeyCode();
-    if ((key > WXK_ESCAPE) &&
-        (key != WXK_DELETE) && (key < 255) &&
-        !evt.ControlDown() && !evt.AltDown()) {
-
+    if (key <= 0xff && !iscntrl(key) && !m_lastKeyDownConsumed) {
         m_swx->DoAddChar(key);
     }
-    else {
-        evt.Skip();
-    }
 }
 
+
 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
     long key = evt.KeyCode();
-    //key = toupper(key);  //**** ????
-    bool consumed = FALSE;
     int processed = m_swx->DoKeyDown(key,
                                      evt.ShiftDown(),
                                      evt.ControlDown(),
                                      evt.AltDown(),
-                                     &consumed);
-    if (!processed && !consumed)
+                                     &m_lastKeyDownConsumed);
+    if (!processed && !m_lastKeyDownConsumed)
         evt.Skip();
 }
 
+
 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
     m_swx->DoLoseFocus();
 }
 
+
 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) {
     m_swx->DoGainFocus();
 }
 
+
 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& evt) {
     m_swx->DoSysColourChange();
 }
 
+
 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& evt) {
     // do nothing to help avoid flashing
 }