From 1a7f9124b66989abaaa726e369c5b7ad3418e831 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 17 Jan 2019 12:00:01 +0000 Subject: [PATCH] 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. --- src/qt/textentry.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qt/textentry.cpp b/src/qt/textentry.cpp index f1c088165a..6a5cbc71dd 100644 --- a/src/qt/textentry.cpp +++ b/src/qt/textentry.cpp @@ -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(string.length())) ); } void wxTextEntry::Copy()