rcfile: unbind keys by their key code instead of by their key string
Some key strings map to the same key code, so to unbind also a string's synonyms, go through the list comparing against the key code. It has the additional advantage that it is faster: a plain value comparison instead of a string comparison. There is no need to compare also the meta flag, because plain printable ASCII characters (from 0x20 to 0x7E) cannot be shortcuts, so when such a character matches, it necessarily means it is a meta keystroke. This fixes https://savannah.gnu.org/bugs/?57397.master
parent
5130c35b85
commit
9e3fca4021
|
@ -800,7 +800,7 @@ void parse_binding(char *ptr, bool dobind)
|
|||
|
||||
/* Wipe the given shortcut from the given menu. */
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if ((s->menus & menu) && strcmp(s->keystr, keycopy) == 0)
|
||||
if ((s->menus & menu) && s->keycode == keycode)
|
||||
s->menus &= ~menu;
|
||||
|
||||
/* When unbinding, we are done now. */
|
||||
|
|
Loading…
Reference in New Issue