Merge pull request #22194 from Gymnasiast/fix/22161

Fix #22161: Using arrow keys in textboxes crashes the game
This commit is contained in:
Michael Steenbeek authored and GitHub committed 2024-06-25 12:19:23 +02:00
commit a4839ea975
2 files changed
+3 -1

No files matched your search

+1
View File
@@ -39,6 +39,7 @@
- Fix: [#22012] [Plugin] Images on ImgButton widgets cannot be updated.
- Fix: [#22121] Some news items in the “Recent Messages” window have the wrong text colour.
- Fix: [#22152] [Plugin] Negative signed integers are truncated.
- Fix: [#22161] Using arrow keys in textboxes crashes the game.
- Fix: [#22174] Cheats are reset when starting a server.
- Fix: [objects#323] Incorrect wall boundaries on large WW/TT scenery objects.
- Fix: [objects#331] Incorrect hover car capacity string.
+2 -1
View File
@@ -1169,7 +1169,8 @@ static void WidgetTextBoxDraw(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex wid
// Make a new 1 character wide string for measuring the width
// of the character that the cursor is under. (NOTE: this is broken for multi byte utf8 codepoints)
width = std::max(
GfxGetStringWidthNoFormatting(u8string{ textInput->Buffer[textInput->SelectionStart] }, FontStyle::Medium) - 2, 4);
GfxGetStringWidthNoFormatting(u8string{ (*textInput->Buffer)[textInput->SelectionStart] }, FontStyle::Medium) - 2,
4);
}
if (OpenRCT2::Ui::Windows::TextBoxCaretIsFlashed())