From eeaf23168e169e02e92018c8e839a911c855c20e Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Tue, 22 Nov 2022 11:47:28 +0000 Subject: [PATCH] control_presskeys: "Handle" some ASCII chars These printable ASCII characters will result in a text input event and should not be handled further. Fixes #5505 --- Source/control.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/Source/control.cpp b/Source/control.cpp index faca05ff5..f8cf39d25 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1363,21 +1363,26 @@ bool control_presskeys(SDL_Keycode vkey) if (!talkflag) return false; - if (vkey == SDLK_ESCAPE) { + switch (vkey) { + case SDLK_ESCAPE: control_reset_talk(); - } else if (vkey == SDLK_RETURN || vkey == SDLK_KP_ENTER) { + return true; + case SDLK_RETURN: + case SDLK_KP_ENTER: ControlPressEnter(); - } else if (vkey == SDLK_BACKSPACE) { + return true; + case SDLK_BACKSPACE: TalkMessage[FindLastUtf8Symbols(TalkMessage)] = '\0'; - } else if (vkey == SDLK_DOWN) { + return true; + case SDLK_DOWN: ControlUpDown(1); - } else if (vkey == SDLK_UP) { + return true; + case SDLK_UP: ControlUpDown(-1); - } else if (vkey != SDLK_SPACE) { - return false; + return true; + default: + return vkey >= SDLK_SPACE && vkey <= SDLK_z; } - - return true; } void DiabloHotkeyMsg(uint32_t dwMsg)