summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-06-01 16:09:36 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-06-01 16:09:36 +0000
commit6e01be3914f6fb3141e77eb4efa74e88439382bd (patch)
tree08f283c3979f2f90c59429b16e2beb761222d0b7
parentc5268597e1574456f28df5ed3b7051c93c6c901a (diff)
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.
-rw-r--r--usr.bin/tmux/input-keys.c14
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));