X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bcd055ae108a30299fa278f3fe774f52414eb3df..c13c9657a402c546d36d51628aec65903deb6605:/src/motif/textctrl.cpp diff --git a/src/motif/textctrl.cpp b/src/motif/textctrl.cpp index ce98355f14..9dbff0adb2 100644 --- a/src/motif/textctrl.cpp +++ b/src/motif/textctrl.cpp @@ -25,6 +25,8 @@ #define XtParent XTPARENT #endif +#include "wx/defs.h" + #include #include #include @@ -304,7 +306,7 @@ bool wxTextCtrl::CanCut() const // Can cut if there's a selection long from, to; GetSelection(& from, & to); - return (from != to) ; + return (from != to) && (IsEditable()); } bool wxTextCtrl::CanPaste() const @@ -393,6 +395,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 +670,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 +765,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 +781,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; )