X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5a25f8581a6e11d4a7d61d40434a826a1a228d53..4b5e178a4c22caac92952131632641c63821fc0c:/src/common/textentrycmn.cpp?ds=inline diff --git a/src/common/textentrycmn.cpp b/src/common/textentrycmn.cpp index c6b769601e..b179499381 100644 --- a/src/common/textentrycmn.cpp +++ b/src/common/textentrycmn.cpp @@ -40,9 +40,11 @@ wxString wxTextEntryBase::GetRange(long from, long to) const { wxString sel; - if ( from < to ) + wxString value = GetValue(); + + if ( from < to && (long)value.length() >= to ) { - sel = GetValue().substr(from, to - from); + sel = value.substr(from, to - from); } return sel; @@ -60,6 +62,8 @@ void wxTextEntryBase::DoSetValue(const wxString& value, int flags) SelectAll(); WriteText(value); + + SetInsertionPoint(0); } void wxTextEntryBase::Replace(long from, long to, const wxString& value) @@ -69,6 +73,7 @@ void wxTextEntryBase::Replace(long from, long to, const wxString& value) Remove(from, to); } + SetInsertionPoint(from); WriteText(value); }