mirror of https://github.com/odrling/Aegisub
Fix selection preserving in SubsTextEditCtrl::SetTextTo
Calling GetReverseUnicodePosition on the selection positioning after calling SetText resulted in the conversions between UTF-8 indices and wxString indices just being a very slow no-op.
This commit is contained in:
parent
8ab163cb5a
commit
b9b804ff55
|
@ -279,14 +279,13 @@ void SubsTextEditCtrl::SetTextTo(wxString const& text) {
|
|||
SetEvtHandlerEnabled(false);
|
||||
Freeze();
|
||||
|
||||
int from=0,to=0;
|
||||
GetSelection(&from,&to);
|
||||
int from = GetReverseUnicodePosition(GetSelectionStart());
|
||||
int to = GetReverseUnicodePosition(GetSelectionEnd());
|
||||
|
||||
line_text.clear();
|
||||
SetText(text);
|
||||
|
||||
// Restore selection
|
||||
SetSelectionU(GetReverseUnicodePosition(from), GetReverseUnicodePosition(to));
|
||||
SetSelectionU(from, to);
|
||||
|
||||
SetEvtHandlerEnabled(true);
|
||||
Thaw();
|
||||
|
|
Loading…
Reference in New Issue