summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-03-22 10:30:05 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-03-22 10:30:05 +0000
commitc87d5e1ca3a69b663a26ca7aedf285dd42cf4266 (patch)
tree78f0848c6c7a78c0476ecb62cc2991cb09875350
parente73e1c0ae5a14766b7936f16006ef0d3edcedafb (diff)
In terminals with XT, turn on modifyOtherKeys=1 with the escape sequence
and handle the most common set. Pass them through if xterm-keys is on.
-rw-r--r--usr.bin/tmux/key-string.c13
-rw-r--r--usr.bin/tmux/tty.c7
-rw-r--r--usr.bin/tmux/xterm-keys.c30
3 files changed, 41 insertions, 9 deletions
diff --git a/usr.bin/tmux/key-string.c b/usr.bin/tmux/key-string.c
index 2de7682407b..0012f89771d 100644
--- a/usr.bin/tmux/key-string.c
+++ b/usr.bin/tmux/key-string.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: key-string.c,v 1.23 2012/03/04 20:40:54 nicm Exp $ */
+/* $OpenBSD: key-string.c,v 1.24 2013/03/22 10:30:04 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -136,9 +136,10 @@ key_string_get_modifiers(const char **string)
int
key_string_lookup_string(const char *string)
{
- int key, modifiers;
- u_short u;
- int size;
+ static const char *other = "!#()+,-.0123456789:;<=>?'\r\t";
+ int key, modifiers;
+ u_short u;
+ int size;
/* Is this a hexadecimal value? */
if (string[0] == '0' && string[1] == 'x') {
@@ -170,7 +171,7 @@ key_string_lookup_string(const char *string)
}
/* Convert the standard control keys. */
- if (key < KEYC_BASE && (modifiers & KEYC_CTRL)) {
+ if (key < KEYC_BASE && (modifiers & KEYC_CTRL) && !strchr(other, key)) {
if (key >= 97 && key <= 122)
key -= 96;
else if (key >= 64 && key <= 95)
@@ -193,7 +194,7 @@ key_string_lookup_key(int key)
{
static char out[24];
char tmp[8];
- u_int i;
+ u_int i;
*out = '\0';
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 2390bfaf11e..6c8eb3ddc0e 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.150 2013/03/22 10:29:31 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.151 2013/03/22 10:30:04 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -223,7 +223,7 @@ tty_start_tty(struct tty *tty)
tty_puts(tty, "\033[?1000l");
if (tty_term_has(tty->term, TTYC_XT))
- tty_puts(tty, "\033[c");
+ tty_puts(tty, "\033[c\033[>4;1m");
tty->cx = UINT_MAX;
tty->cy = UINT_MAX;
@@ -285,6 +285,9 @@ tty_stop_tty(struct tty *tty)
if (tty_term_has(tty->term, TTYC_KMOUS))
tty_raw(tty, "\033[?1000l");
+ if (tty_term_has(tty->term, TTYC_XT))
+ tty_puts(tty, "\033[>4m");
+
tty_raw(tty, tty_term_string(tty->term, TTYC_RMCUP));
setblocking(tty->fd, 1);
diff --git a/usr.bin/tmux/xterm-keys.c b/usr.bin/tmux/xterm-keys.c
index 6980d36cbf0..87962c9a68c 100644
--- a/usr.bin/tmux/xterm-keys.c
+++ b/usr.bin/tmux/xterm-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xterm-keys.c,v 1.10 2011/06/23 10:02:49 nicm Exp $ */
+/* $OpenBSD: xterm-keys.c,v 1.11 2013/03/22 10:30:04 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -87,6 +87,34 @@ const struct xterm_keys_entry xterm_keys_table[] = {
{ KEYC_NPAGE, "\033[6;_~" },
{ KEYC_IC, "\033[2;_~" },
{ KEYC_DC, "\033[3;_~" },
+
+ { '!', "\033[27;_;33~" },
+ { '#', "\033[27;_;35~" },
+ { '(', "\033[27;_;40~" },
+ { ')', "\033[27;_;41~" },
+ { '+', "\033[27;_;43~" },
+ { ',', "\033[27;_;44~" },
+ { '-', "\033[27;_;45~" },
+ { '.', "\033[27;_;46~" },
+ { '0', "\033[27;_;48~" },
+ { '1', "\033[27;_;49~" },
+ { '2', "\033[27;_;50~" },
+ { '3', "\033[27;_;51~" },
+ { '4', "\033[27;_;52~" },
+ { '5', "\033[27;_;53~" },
+ { '6', "\033[27;_;54~" },
+ { '7', "\033[27;_;55~" },
+ { '8', "\033[27;_;56~" },
+ { '9', "\033[27;_;57~" },
+ { ':', "\033[27;_;58~" },
+ { ';', "\033[27;_;59~" },
+ { '<', "\033[27;_;60~" },
+ { '=', "\033[27;_;61~" },
+ { '>', "\033[27;_;62~" },
+ { '?', "\033[27;_;63~" },
+ { '\'', "\033[27;_;39~" },
+ { '\r', "\033[27;_;13~" },
+ { '\t', "\033[27;_;9~" },
};
/*