Update insertion point in wxTextEntry::Remove()

Move the insertion point to the end of the string if its position has
become invalid after removing part of the text.
This commit is contained in:
Richard Smith
2019-01-17 12:00:01 +00:00
committed by Vadim Zeitlin
parent b0defd5876
commit 1a7f9124b6

View File

@@ -20,9 +20,11 @@ void wxTextEntry::WriteText(const wxString& WXUNUSED(text))
void wxTextEntry::Remove(long from, long to)
{
const long insertionPoint = GetInsertionPoint();
wxString string = GetValue();
string.erase(from, to - from);
SetValue(string);
SetInsertionPoint( std::min(insertionPoint, static_cast<long>(string.length())) );
}
void wxTextEntry::Copy()