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);
|
SetEvtHandlerEnabled(false);
|
||||||
Freeze();
|
Freeze();
|
||||||
|
|
||||||
int from=0,to=0;
|
int from = GetReverseUnicodePosition(GetSelectionStart());
|
||||||
GetSelection(&from,&to);
|
int to = GetReverseUnicodePosition(GetSelectionEnd());
|
||||||
|
|
||||||
line_text.clear();
|
line_text.clear();
|
||||||
SetText(text);
|
SetText(text);
|
||||||
|
|
||||||
// Restore selection
|
SetSelectionU(from, to);
|
||||||
SetSelectionU(GetReverseUnicodePosition(from), GetReverseUnicodePosition(to));
|
|
||||||
|
|
||||||
SetEvtHandlerEnabled(true);
|
SetEvtHandlerEnabled(true);
|
||||||
Thaw();
|
Thaw();
|
||||||
|
|
Loading…
Reference in New Issue