rcfile: reject things like "M-Del" and "^{" as invalid key names
This fixes https://savannah.gnu.org/bugs/?54274.master
parent
acadf71b13
commit
3bac3c4c78
|
@ -448,14 +448,14 @@ int keycode_from_string(const char *keystring)
|
||||||
if (keystring[0] == '^') {
|
if (keystring[0] == '^') {
|
||||||
if (strcasecmp(keystring, "^Space") == 0)
|
if (strcasecmp(keystring, "^Space") == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (strlen(keystring) == 2)
|
if (keystring[1] <= '_' && strlen(keystring) == 2)
|
||||||
return keystring[1] - 64;
|
return keystring[1] - 64;
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
} else if (keystring[0] == 'M') {
|
} else if (keystring[0] == 'M') {
|
||||||
if (strcasecmp(keystring, "M-Space") == 0)
|
if (strcasecmp(keystring, "M-Space") == 0)
|
||||||
return (int)' ';
|
return (int)' ';
|
||||||
if (keystring[1] == '-')
|
if (keystring[1] == '-' && strlen(keystring) == 3)
|
||||||
return tolower((unsigned char)keystring[2]);
|
return tolower((unsigned char)keystring[2]);
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue