]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/textctrl.cpp
applied patch 1908782 wxAuiMDIChildFrame not removed from wxAuiMDIClientWindow
[wxWidgets.git] / src / mac / carbon / textctrl.cpp
index 79c591439cd03e4706877389fe88e572a0682f2c..6aac442420314221f6fdb3b41583e0a4e894de5e 100644 (file)
@@ -189,7 +189,7 @@ wxMacPortSaver( (GrafPtr) GetWindowPort( (WindowRef) win->MacGetTopLevelWindowRe
     m_formerClip = NewRgn() ;
     m_newClip = NewRgn() ;
     GetClip( m_formerClip ) ;
-    
+
     if ( win )
     {
         // guard against half constructed objects, this just leads to a empty clip
@@ -197,13 +197,13 @@ wxMacPortSaver( (GrafPtr) GetWindowPort( (WindowRef) win->MacGetTopLevelWindowRe
         {
             int x = 0 , y = 0;
             win->MacWindowToRootWindow( &x, &y ) ;
-            
+
             // get area including focus rect
             HIShapeGetAsQDRgn( ((wxWindow*)win)->MacGetVisibleRegion(true).GetWXHRGN() , m_newClip );
             if ( !EmptyRgn( m_newClip ) )
                 OffsetRgn( m_newClip , x , y ) ;
         }
-        
+
         SetClip( m_newClip ) ;
     }
 }
@@ -828,6 +828,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
 {
     int key = event.GetKeyCode() ;
     bool eat_key = false ;
+    long from, to;
 
     if ( key == 'a' && event.MetaDown() )
     {
@@ -855,10 +856,11 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
 
     // Check if we have reached the max # of chars (if it is set), but still
     // allow navigation and deletion
+    GetSelection( &from, &to );
     if ( !IsMultiLine() && m_maxLength && GetValue().length() >= m_maxLength &&
         key != WXK_LEFT && key != WXK_RIGHT && key != WXK_TAB &&
-        key != WXK_BACK && !( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) )
-       )
+        key != WXK_BACK && key != WXK_DELETE && !( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) ) &&
+        from == to )
     {
         // eat it, we don't want to add more than allowed # of characters
 
@@ -1763,11 +1765,11 @@ void wxMacMLTEControl::AdjustCreationAttributes(const wxColour &background,
             | kTXNSupportFontCommandProcessing
             | kTXNSupportFontCommandUpdating;
 
-        // only spell check when not read-only 
+        // only spell check when not read-only
         // use system options for the default
-        bool checkSpelling = false ; 
+        bool checkSpelling = false ;
         if ( !(m_windowStyle & wxTE_READONLY) )
-        {   
+        {
 #if wxUSE_SYSTEM_OPTIONS
             if ( wxSystemOptions::HasOption( wxMAC_TEXTCONTROL_USE_SPELL_CHECKER ) && (wxSystemOptions::GetOptionInt( wxMAC_TEXTCONTROL_USE_SPELL_CHECKER ) == 1) )
             {
@@ -1775,11 +1777,11 @@ void wxMacMLTEControl::AdjustCreationAttributes(const wxColour &background,
             }
 #endif
         }
-        
+
         if ( checkSpelling )
             options |=
                 kTXNSupportSpellCheckCommandProcessing
-                | kTXNSupportSpellCheckCommandUpdating;              
+                | kTXNSupportSpellCheckCommandUpdating;
 
         TXNSetCommandEventSupport( m_txn , options ) ;
     }