1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

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
2024-06-25 12:19:23 +02:00
committed by GitHub
2 changed files with 3 additions and 1 deletions

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.

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())