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:
committed by
Vadim Zeitlin
parent
b0defd5876
commit
1a7f9124b6
@@ -20,9 +20,11 @@ void wxTextEntry::WriteText(const wxString& WXUNUSED(text))
|
|||||||
|
|
||||||
void wxTextEntry::Remove(long from, long to)
|
void wxTextEntry::Remove(long from, long to)
|
||||||
{
|
{
|
||||||
|
const long insertionPoint = GetInsertionPoint();
|
||||||
wxString string = GetValue();
|
wxString string = GetValue();
|
||||||
string.erase(from, to - from);
|
string.erase(from, to - from);
|
||||||
SetValue(string);
|
SetValue(string);
|
||||||
|
SetInsertionPoint( std::min(insertionPoint, static_cast<long>(string.length())) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextEntry::Copy()
|
void wxTextEntry::Copy()
|
||||||
|
Reference in New Issue
Block a user