diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-05-19 10:59:10 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-05-19 10:59:10 +0000 |
commit | cfc0d63ef2bed2ff1c2677bac127d177ca81a937 (patch) | |
tree | c1379e9926d02c869447a76abf8f65302820cba3 /usr.bin | |
parent | 2df3d9b86834856a561f94bc2be40aff0639e730 (diff) |
Some other ctrl keys need to be translated with extended keys on.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/input-keys.c | 35 | ||||
-rw-r--r-- | usr.bin/tmux/tty-features.c | 4 |
2 files changed, 32 insertions, 7 deletions
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 <nicholas.marriott@gmail.com> @@ -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) { diff --git a/usr.bin/tmux/tty-features.c b/usr.bin/tmux/tty-features.c index efa3037fef4..d4c05f83a60 100644 --- a/usr.bin/tmux/tty-features.c +++ b/usr.bin/tmux/tty-features.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-features.c,v 1.14 2020/05/16 16:44:54 nicm Exp $ */ +/* $OpenBSD: tty-features.c,v 1.15 2020/05/19 10:59:09 nicm Exp $ */ /* * Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -343,7 +343,7 @@ tty_default_features(int *feat, const char *name, u_int version) .features = "256,bpaste,ccolour,cstyle,title" }, { .name = "iTerm2", - .features = TTY_FEATURES_BASE_MODERN_XTERM ",cstyle,margins,sync" + .features = TTY_FEATURES_BASE_MODERN_XTERM ",cstyle,extkeys,margins,sync" }, { .name = "XTerm", .features = TTY_FEATURES_BASE_MODERN_XTERM ",ccolour,cstyle,extkeys,focus,margins,rectfill" |