X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e9863f4ea1ab957e59b421d36e6199c7b472476d..67badd5753e70eb50de5ae43ff454e7c1f311e50:/src/common/textentrycmn.cpp diff --git a/src/common/textentrycmn.cpp b/src/common/textentrycmn.cpp index 5ec6850708..b179499381 100644 --- a/src/common/textentrycmn.cpp +++ b/src/common/textentrycmn.cpp @@ -41,10 +41,10 @@ wxString wxTextEntryBase::GetRange(long from, long to) const { wxString sel; wxString value = GetValue(); - - if ((from < to) && ((long)value.length() >= to + from)) + + if ( from < to && (long)value.length() >= to ) { - sel = GetValue().substr(from, to - from); + sel = value.substr(from, to - from); } return sel; @@ -62,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) @@ -71,6 +73,7 @@ void wxTextEntryBase::Replace(long from, long to, const wxString& value) Remove(from, to); } + SetInsertionPoint(from); WriteText(value); }