nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 620553b79567595628357b4b87d62c78470d8f25
parent 6df50790cdbe5103dd9ec26e2d4e19406cb94737
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed, 22 Jan 2020 16:15:30 +0100

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).

Diffstat:
Msrc/global.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git 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. */