diff options
author | 2020-06-01 16:09:35 +0000 | |
---|---|---|
committer | 2020-06-01 16:09:35 +0000 | |
commit | cd4ae116f24abdaf9c62e452a5d6972e5b73c4e8 (patch) | |
tree | 9c28773a2496f5cef38930a0a55ab4a32cf32163 /usr.bin/tmux/input-keys.c | |
parent | Enable the test-tls13-zero-length-data.py test, skipping the (diff) | |
download | wireguard-openbsd-cd4ae116f24abdaf9c62e452a5d6972e5b73c4e8.tar.xz wireguard-openbsd-cd4ae116f24abdaf9c62e452a5d6972e5b73c4e8.zip |
Try without cursor/keypad flags if a key doesn't exist, and limit ctrl
key translation to ASCII keys. Fixes send-keys, GitHub issue 2247.
Diffstat (limited to 'usr.bin/tmux/input-keys.c')
-rw-r--r-- | usr.bin/tmux/input-keys.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.bin/tmux/input-keys.c b/usr.bin/tmux/input-keys.c index 1782bae8eaa..ae2eccad7af 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.78 2020/05/25 18:57:25 nicm Exp $ */ +/* $OpenBSD: input-keys.c,v 1.79 2020/06/01 16:09:35 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -487,9 +487,13 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key) ike = input_key_get(key); if (ike == NULL && (key & KEYC_META) && (~key & KEYC_IMPLIED_META)) ike = input_key_get(key & ~KEYC_META); + if (ike == NULL && (key & KEYC_CURSOR)) + ike = input_key_get(key & ~KEYC_CURSOR); + if (ike == NULL && (key & KEYC_KEYPAD)) + ike = input_key_get(key & ~KEYC_KEYPAD); if (ike != NULL) { log_debug("found key 0x%llx: \"%s\"", key, ike->data); - if (key & KEYC_META && (~key & KEYC_IMPLIED_META)) + if ((key & KEYC_META) && (~key & KEYC_IMPLIED_META)) bufferevent_write(bev, "\033", 1); bufferevent_write(bev, ike->data, strlen(ike->data)); return (0); @@ -497,13 +501,13 @@ 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) { - justkey = (key & KEYC_MASK_KEY); if ((key & KEYC_MASK_MODIFIERS) != KEYC_CTRL) goto missing; + justkey = (key & KEYC_MASK_KEY); switch (justkey) { case ' ': case '2': - key = 0||(key & ~KEYC_MASK_KEY); + key = 0|(key & ~KEYC_MASK_KEY); break; case '|': key = 28|(key & ~KEYC_MASK_KEY); @@ -523,6 +527,8 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key) key = (justkey - 'A')|(key & ~KEYC_MASK_KEY); else if (justkey >= 'a' && justkey <= '~') key = (justkey - 96)|(key & ~KEYC_MASK_KEY); + else + return (0); break; } return (input_key(s, bev, key & ~KEYC_CTRL)); |