]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/textctrl.cpp
(hopefully) workaround for a carbon bug not always setting the modifiers event record...
[wxWidgets.git] / src / motif / textctrl.cpp
index 3a66bd8ff8a6661ecacf9abedfb47e1610558110..5e602b8a44e68127f3f20f64cc11c188264df4f2 100644 (file)
@@ -393,6 +393,9 @@ void wxTextCtrl::Remove(long from, long to)
 
 void wxTextCtrl::SetSelection(long from, long to)
 {
+    if( to == -1 )
+        to = GetLastPosition();
+
     XmTextSetSelection ((Widget) m_mainWidget, (XmTextPosition) from, (XmTextPosition) to,
                       (Time) 0);
 }
@@ -665,7 +668,7 @@ void wxTextCtrl::ChangeBackgroundColour()
             XmNhorizontalScrollBar, &hsb,
             XmNverticalScrollBar, &vsb,
             NULL);
-        wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
+        wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
         if (hsb)
             DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
         if (vsb)
@@ -760,7 +763,9 @@ static void MergeChangesIntoString(wxString& value,
         const char * const passwd = value;
         int len = value.length();
 
-        len += strlen(cbs->text->ptr) + 1;     // + new text (if any) + NUL
+        len += ( cbs->text->ptr ?
+                 strlen(cbs->text->ptr) :
+                 0 ) + 1;                      // + new text (if any) + NUL
         len -= cbs->endPos - cbs->startPos;    // - text from affected region.
 
         char * newS = new char [len];
@@ -774,8 +779,9 @@ static void MergeChangesIntoString(wxString& value,
             *dest++ = *p++;
 
         // Copy the text to be inserted).
-        while (*insert)
-            *dest++ = *insert++;
+        if (insert)
+            while (*insert)
+                *dest++ = *insert++;
 
         // Finally, copy into newS any remaining text from passwd[endPos] on.
         for (p = passwd + cbs->endPos; *p; )