From 658f06b83af50630cf8b58ef030b11a6e26ebad6 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Sun, 1 Dec 2024 18:20:23 +0700 Subject: [PATCH] eat keys in chat "macro" mode, fix backspace (#2063) * filter special keys in GetTypedChar --- src/i_input.c | 10 ++++++++++ src/st_widgets.c | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/i_input.c b/src/i_input.c index 18036e98..e8fc39aa 100644 --- a/src/i_input.c +++ b/src/i_input.c @@ -722,6 +722,16 @@ static int GetTypedChar(SDL_Keysym *sym) { int result = TranslateKey(sym); + switch (result) + { + case KEY_BACKSPACE: + case KEY_ESCAPE: + case KEY_ENTER: + return 0; + default: + break; + } + // If shift is held down, apply the original uppercase // translation table used under DOS. if ((SDL_GetModState() & KMOD_SHIFT) != 0 && result >= 0 diff --git a/src/st_widgets.c b/src/st_widgets.c index ebd84fd9..9704f767 100644 --- a/src/st_widgets.c +++ b/src/st_widgets.c @@ -403,7 +403,7 @@ boolean ST_MessagesResponder(event_t *ev) ch = ch - '0'; if (ch < 0 || ch > 9) { - return false; + return true; } const char *macromessage = chat_macros[ch]; @@ -432,7 +432,7 @@ boolean ST_MessagesResponder(event_t *ev) { txt = ev->data1.i; } - else if (ch == KEY_ENTER) + else if (ch == KEY_ENTER || ch == KEY_BACKSPACE) { txt = ch; }