1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 13:33:02 +01:00

Fix #20628: Stop caret left moving off the input string

This commit is contained in:
Ota
2024-01-19 13:48:51 +01:00
committed by GitHub
parent 00b5932557
commit 33523c98c2
2 changed files with 6 additions and 3 deletions

View File

@@ -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<size_t>(0, _session.SelectionSize - (selectionOffset - _session.SelectionStart));
_session.SelectionSize = _session.SelectionSize - (selectionOffset - _session.SelectionStart);
_session.SelectionStart = selectionOffset == 0 ? 0 : lastChar;
}