X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8611662072d09a578096fc73d7b44933e206b85c..92159e3d769551d78d8f48f438fc8c40655d23d2:/src/common/textentrycmn.cpp diff --git a/src/common/textentrycmn.cpp b/src/common/textentrycmn.cpp index 7324f6194c..5ec6850708 100644 --- a/src/common/textentrycmn.cpp +++ b/src/common/textentrycmn.cpp @@ -40,7 +40,9 @@ wxString wxTextEntryBase::GetRange(long from, long to) const { wxString sel; - if ( from < to ) + wxString value = GetValue(); + + if ((from < to) && ((long)value.length() >= to + from)) { sel = GetValue().substr(from, to - from); } @@ -80,6 +82,14 @@ bool wxTextEntryBase::HasSelection() const return from < to; } +void wxTextEntryBase::RemoveSelection() +{ + long from, to; + GetSelection(& from, & to); + if (from != -1 && to != -1) + Remove(from, to); +} + wxString wxTextEntryBase::GetStringSelection() const { long from, to; @@ -104,8 +114,14 @@ bool wxTextEntryBase::CanPaste() const { #if wxUSE_CLIPBOARD // check if there is any text on the clipboard - if ( wxTheClipboard->IsSupported(wxDF_TEXT) ) + if ( wxTheClipboard->IsSupported(wxDF_TEXT) +#if wxUSE_UNICODE + || wxTheClipboard->IsSupported(wxDF_UNICODETEXT) +#endif // wxUSE_UNICODE + ) + { return true; + } #endif // wxUSE_CLIPBOARD }