From cfc0d63ef2bed2ff1c2677bac127d177ca81a937 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 19 May 2020 10:59:10 +0000 Subject: Some other ctrl keys need to be translated with extended keys on. --- usr.bin/tmux/input-keys.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'usr.bin/tmux/input-keys.c') diff --git a/usr.bin/tmux/input-keys.c b/usr.bin/tmux/input-keys.c index 4936fa35b36..2a7909fcfc8 100644 --- a/usr.bin/tmux/input-keys.c +++ b/usr.bin/tmux/input-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: input-keys.c,v 1.76 2020/05/16 16:44:54 nicm Exp $ */ +/* $OpenBSD: input-keys.c,v 1.77 2020/05/19 10:59:09 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -498,10 +498,35 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key) /* No builtin key sequence; construct an extended key sequence. */ if (~s->mode & MODE_KEXTENDED) { - if ((key & KEYC_MASK_MODIFIERS) == KEYC_CTRL && - (key & KEYC_MASK_KEY) < KEYC_BASE) - return (input_key(s, bev, key & ~KEYC_CTRL)); - goto missing; + justkey = (key & KEYC_MASK_KEY); + if ((key & KEYC_MASK_MODIFIERS) != KEYC_CTRL) + goto missing; + switch (justkey) { + case ' ': + case '2': + key = 0||(key & ~KEYC_MASK_KEY); + break; + case '|': + key = 28|(key & ~KEYC_MASK_KEY); + break; + case '6': + key = 30|(key & ~KEYC_MASK_KEY); + break; + case '-': + case '/': + key = 31|(key & ~KEYC_MASK_KEY); + break; + case '?': + key = 127|(key & ~KEYC_MASK_KEY); + break; + default: + if (justkey >= 'A' && justkey <= '_') + key = (justkey - 'A')|(key & ~KEYC_MASK_KEY); + else if (justkey >= 'a' && justkey <= '~') + key = (justkey - 96)|(key & ~KEYC_MASK_KEY); + break; + } + return (input_key(s, bev, key & ~KEYC_CTRL)); } outkey = (key & KEYC_MASK_KEY); switch (key & KEYC_MASK_MODIFIERS) { -- cgit v1.2.3