mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-17 01:21:12 +00:00
(More) special cases for key names in configs
There already was one (that I only recently fixed) for semicolon, but the same problem can happen with quotes or $ (which is used in macros) (single-quote ' is probably not affected, added it just to be sure)
This commit is contained in:
parent
d6cdcc3e52
commit
d675254e4e
2 changed files with 14 additions and 4 deletions
|
@ -64,7 +64,10 @@ keyname_t keynames[] = {
|
|||
{"ENTER", K_ENTER},
|
||||
{"ESCAPE", K_ESCAPE},
|
||||
{"SPACE", K_SPACE},
|
||||
{"SEMICOLON", ';'}, /* because a raw semicolon separates commands */
|
||||
{"SEMICOLON", ';'}, /* because a raw semicolon separates commands */
|
||||
{"DOUBLEQUOTE", '"'}, /* because "" has special meaning in configs */
|
||||
{"QUOTE", '\'' }, /* just to be sure */
|
||||
{"DOLLAR", '$'}, /* $ is used in macros => can occur in configs */
|
||||
{"BACKSPACE", K_BACKSPACE},
|
||||
|
||||
{"COMMAND", K_COMMAND},
|
||||
|
@ -733,9 +736,11 @@ Key_KeynumToString(int keynum)
|
|||
return "<KEY NOT FOUND>";
|
||||
}
|
||||
|
||||
if ((keynum > 32) && (keynum < 127) && keynum != ';')
|
||||
if ((keynum > 32) && (keynum < 127) && keynum != ';' && keynum != '"' && keynum != '\'' && keynum != '$')
|
||||
{
|
||||
/* printable ascii, except for semicolon special case */
|
||||
/* printable ASCII, except for special cases that have special meanings
|
||||
in configs like quotes or ; (separates commands) or $ (used to expand
|
||||
cvars to their values in macros/commands) and thus need escaping */
|
||||
tinystr[0] = keynum;
|
||||
return tinystr;
|
||||
}
|
||||
|
|
|
@ -47,11 +47,16 @@
|
|||
extern qboolean joy_altselector_pressed;
|
||||
|
||||
/* these are the key numbers that should be passed to Key_Event
|
||||
they must be mached by the low level key event processing! */
|
||||
they must be matched by the low level key event processing! */
|
||||
enum QKEYS {
|
||||
K_TAB = 9,
|
||||
K_ENTER = 13,
|
||||
K_ESCAPE = 27,
|
||||
// Note: ASCII keys are generally valid but don't get constants here,
|
||||
// just use 'a' (yes, lowercase) or '2' or whatever, however there are
|
||||
// some special cases when writing/parsing configs (space or quotes or
|
||||
// also ; and $ have a special meaning there so we use e.g. "SPACE" instead),
|
||||
// see keynames[] in cl_keyboard.c
|
||||
K_SPACE = 32,
|
||||
|
||||
K_BACKSPACE = 127,
|
||||
|
|
Loading…
Reference in a new issue