From 6bde1c183766d0637633c1460cf6b17b57bc0280 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 20 May 2020 07:11:45 +0000 Subject: [PATCH] Fix a couple more places where the key flags need to be masked off. --- key-bindings.c | 2 +- key-string.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/key-bindings.c b/key-bindings.c index 59cfbb0d..a518fbd8 100644 --- a/key-bindings.c +++ b/key-bindings.c @@ -197,7 +197,7 @@ key_bindings_add(const char *name, key_code key, const char *note, int repeat, } bd = xcalloc(1, sizeof *bd); - bd->key = key; + bd->key = (key & ~KEYC_MASK_FLAGS); if (note != NULL) bd->note = xstrdup(note); RB_INSERT(key_bindings, &table->key_bindings, bd); diff --git a/key-string.c b/key-string.c index 79f80554..1efb6e0b 100644 --- a/key-string.c +++ b/key-string.c @@ -339,7 +339,7 @@ key_string_lookup_key(key_code key, int with_flags) /* Try the key against the string table. */ for (i = 0; i < nitems(key_string_table); i++) { - if (key == key_string_table[i].key) + if (key == (key_string_table[i].key & KEYC_MASK_KEY)) break; } if (i != nitems(key_string_table)) { @@ -359,7 +359,7 @@ key_string_lookup_key(key_code key, int with_flags) /* Invalid keys are errors. */ if (key > 255) { - snprintf(out, sizeof out, "Invalid#%llx", key); + snprintf(out, sizeof out, "Invalid#%llx", saved); goto out; }