diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 6fef16d23d..88619ef374 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -4,6 +4,7 @@ - Improved: [#20951] Activate OpenRCT2 window after using native file dialog on macOS. - Fix: [#20255] Images from the last hovered-over coaster in the object selection are not freed. - Fix: [#20616] Confirmation button in the track designer’s quit prompt has the wrong text. +- Fix: [#20628] Moving caret using Ctrl+left can move too far when using a multibyte grapheme. - Fix: [#21145] [Plugin] setInterval/setTimeout handle conflict. - Fix: [#21157] [Plugin] Widgets do not redraw correctly when updating disabled or visibility state. - Fix: [#21158] [Plugin] Potential crash using setInterval/setTimeout within the callback. diff --git a/src/openrct2-ui/TextComposition.cpp b/src/openrct2-ui/TextComposition.cpp index fd39cb27ee..48f26c3d25 100644 --- a/src/openrct2-ui/TextComposition.cpp +++ b/src/openrct2-ui/TextComposition.cpp @@ -276,7 +276,8 @@ void TextComposition::CaretMoveToLeftToken() lastChar = selectionOffset; break; } - + if (selectionOffset == 0) + break; ch--; selectionOffset--; } @@ -295,12 +296,13 @@ void TextComposition::CaretMoveToLeftToken() break; lastChar = selectionOffset; - + if (selectionOffset == 0) + break; ch--; selectionOffset--; } - _session.SelectionSize = std::max(0, _session.SelectionSize - (selectionOffset - _session.SelectionStart)); + _session.SelectionSize = _session.SelectionSize - (selectionOffset - _session.SelectionStart); _session.SelectionStart = selectionOffset == 0 ? 0 : lastChar; }