mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2025-02-15 08:21:41 +00:00
add \ handling withing "" strings with necessary fix to the keybinding menu.
NOTE: this will break ALL current config scripts that have \ in strings.
This commit is contained in:
parent
1393594ee6
commit
36adeb3bf9
3 changed files with 40 additions and 5 deletions
|
@ -628,17 +628,43 @@ skipwhite:
|
|||
if (c == '\"')
|
||||
{
|
||||
data++;
|
||||
while (1)
|
||||
while (*data && *data!='\"')
|
||||
{
|
||||
c = *data++;
|
||||
if (c=='\"' || !c)
|
||||
{
|
||||
com_token[len] = 0;
|
||||
return data;
|
||||
if (c=='\\') {
|
||||
int base=8;
|
||||
char buf[4];
|
||||
char *str,*string=buf;
|
||||
|
||||
c = *data++;
|
||||
switch (c) {
|
||||
case 'a':c='\a';break;
|
||||
case 'b':c='\b';break;
|
||||
case 'e':c=27 ;break;
|
||||
case 'f':c='\f';break;
|
||||
case 'n':c='\n';break;
|
||||
case 'r':c='\r';break;
|
||||
case 'x':
|
||||
base+=8;
|
||||
string=data;
|
||||
goto parse_char_number;
|
||||
case '0' ... '7':
|
||||
strncpy(buf,data,3);
|
||||
parse_char_number:
|
||||
c=strtol(string,&str,base);
|
||||
if (str==string)
|
||||
c='x';
|
||||
data+=str-string;
|
||||
break;
|
||||
}
|
||||
}
|
||||
com_token[len] = c;
|
||||
len++;
|
||||
}
|
||||
if (*data)
|
||||
data++;
|
||||
com_token[len] = 0;
|
||||
return data;
|
||||
}
|
||||
|
||||
// parse single characters
|
||||
|
|
|
@ -787,6 +787,11 @@ void M_Keys_Key (int k)
|
|||
{
|
||||
bind_grab = false;
|
||||
}
|
||||
else if (k == '\\')
|
||||
{
|
||||
snprintf(cmd, sizeof(cmd), "bind \"\\\\\" \"%s\"\n", bindnames[keys_cursor][0]);
|
||||
Cbuf_InsertText (cmd);
|
||||
}
|
||||
else if (k != '`')
|
||||
{
|
||||
snprintf(cmd, sizeof(cmd), "bind %s \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
|
||||
|
|
|
@ -1486,6 +1486,10 @@ void M_Keys_Key (int k)
|
|||
{
|
||||
bind_grab = false;
|
||||
}
|
||||
else if (k == '\\')
|
||||
{
|
||||
snprintf(cmd, sizeof(cmd), "bind \"\\\\\" \"%s\"\n", bindnames[keys_cursor][0]);
|
||||
}
|
||||
else if (k != '`')
|
||||
{
|
||||
snprintf(cmd, sizeof(cmd), "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
|
||||
|
|
Loading…
Reference in a new issue