Dynamically allocate long text for SDL_EVENT_TEXT_INPUT events

This prevents input text from being split across Unicode combining or modifier characters, and in practice allocations will rarely happen.
This commit is contained in:
Sam Lantinga
2023-11-04 16:53:25 -07:00
parent 2a1660ab51
commit 75ea3a8d32
8 changed files with 25 additions and 12 deletions

View File

@@ -186,6 +186,7 @@ static void loop(void)
case SDL_EVENT_TEXT_INPUT:
PrintText("INPUT", event.text.text);
SDLTest_TextWindowAddText(textwin, "%s", event.text.text);
SDL_CleanupEvent(&event);
break;
case SDL_EVENT_FINGER_DOWN:
if (SDL_TextInputActive()) {