commit 9e3fca4021918fb007653e25042ba3b44482c229
parent 5130c35b8524a3e12c05033731991629bc042517
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 20 Jan 2020 13:34:32 +0100
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.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/rcfile.c b/src/rcfile.c
@@ -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. */