From 620553b79567595628357b4b87d62c78470d8f25 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 22 Jan 2020 16:15:30 +0100 Subject: [PATCH] input: filter out Ctrl+Meta keystrokes, as they can never be shortcuts Note that DEL_CODE (0x7F) will never occur as input key code, because it gets translated to KEY_DC in the input routine (or to KEY_BACKSPACE when --rebinddelete is in effect). --- src/global.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/global.c b/src/global.c index 318fb305..24091aa3 100644 --- a/src/global.c +++ b/src/global.c @@ -449,9 +449,12 @@ size_t shown_entries_for(int menu) * the given sequence. */ const keystruct *get_shortcut(int *kbinput) { - /* Plain characters cannot be shortcuts, so just skip those. */ - if (!meta_key && ((*kbinput >= 0x20 && *kbinput < 0x7F) || - (*kbinput >= 0xA0 && *kbinput <= 0xFF))) + /* Plain characters and upper control codes cannot be shortcuts. */ + if (!meta_key && 0x20 <= *kbinput && *kbinput <= 0xFF) + return NULL; + + /* Lower control codes with Meta cannot be shortcuts either. */ + if (meta_key && *kbinput < 0x20) return NULL; /* During a paste at a prompt, ignore all command keycodes. */