eat keys in chat "macro" mode, fix backspace (#2063)

* filter special keys in GetTypedChar
This commit is contained in:
Roman Fomin 2024-12-01 18:20:23 +07:00 committed by GitHub
parent b6cffcad06
commit 658f06b83a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View File

@ -722,6 +722,16 @@ static int GetTypedChar(SDL_Keysym *sym)
{ {
int result = TranslateKey(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 // If shift is held down, apply the original uppercase
// translation table used under DOS. // translation table used under DOS.
if ((SDL_GetModState() & KMOD_SHIFT) != 0 && result >= 0 if ((SDL_GetModState() & KMOD_SHIFT) != 0 && result >= 0

View File

@ -403,7 +403,7 @@ boolean ST_MessagesResponder(event_t *ev)
ch = ch - '0'; ch = ch - '0';
if (ch < 0 || ch > 9) if (ch < 0 || ch > 9)
{ {
return false; return true;
} }
const char *macromessage = chat_macros[ch]; const char *macromessage = chat_macros[ch];
@ -432,7 +432,7 @@ boolean ST_MessagesResponder(event_t *ev)
{ {
txt = ev->data1.i; txt = ev->data1.i;
} }
else if (ch == KEY_ENTER) else if (ch == KEY_ENTER || ch == KEY_BACKSPACE)
{ {
txt = ch; txt = ch;
} }