summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/tty.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-03-22 10:33:51 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-03-22 10:33:51 +0000
commitffac827263f4af2a6dc14c6618e570c44bd82a20 (patch)
tree5686d858420ea7f80aa2a8c34381a1e2b19901af /usr.bin/tmux/tty.c
parente223112e51a632f343e0df6d1c985e779a98f0a6 (diff)
Support the latest theory for mouse input, this is enabled/disabled with
SM/RM 1006 and is similar in style to SGR input: \033[<b;x;yM or \033[b;x;ym. From Egmont Koblinger.
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r--usr.bin/tmux/tty.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index c59cf67df21..92421a4dc85 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.152 2013/03/22 10:31:22 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.153 2013/03/22 10:33:50 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -218,7 +218,7 @@ tty_start_tty(struct tty *tty)
tty_putcode(tty, TTYC_CNORM);
if (tty_term_has(tty->term, TTYC_KMOUS))
- tty_puts(tty, "\033[?1000l");
+ tty_puts(tty, "\033[?1000l\033[?1006l\033[?1005l");
if (tty_term_has(tty->term, TTYC_XT))
tty_puts(tty, "\033[c\033[>4;1m");
@@ -281,7 +281,7 @@ tty_stop_tty(struct tty *tty)
tty_raw(tty, tty_term_string(tty->term, TTYC_CNORM));
if (tty_term_has(tty->term, TTYC_KMOUS))
- tty_raw(tty, "\033[?1000l");
+ tty_raw(tty, "\033[?1000l\033[?1006l\033[?1005l");
if (tty_term_has(tty->term, TTYC_XT))
tty_puts(tty, "\033[>4m");
@@ -491,8 +491,17 @@ tty_update_mode(struct tty *tty, int mode, struct screen *s)
}
if (changed & ALL_MOUSE_MODES) {
if (mode & ALL_MOUSE_MODES) {
+ /*
+ * Enable the UTF-8 (1005) extension if configured to.
+ * Enable the SGR (1006) extension unconditionally, as
+ * this is safe from misinterpretation. Do it in this
+ * order, because in some terminals it's the last one
+ * that takes effect and SGR is the preferred one.
+ */
if (mode & MODE_MOUSE_UTF8)
tty_puts(tty, "\033[?1005h");
+ tty_puts(tty, "\033[?1006h");
+
if (mode & MODE_MOUSE_ANY)
tty_puts(tty, "\033[?1003h");
else if (mode & MODE_MOUSE_BUTTON)
@@ -506,6 +515,8 @@ tty_update_mode(struct tty *tty, int mode, struct screen *s)
tty_puts(tty, "\033[?1002l");
else if (tty->mode & MODE_MOUSE_STANDARD)
tty_puts(tty, "\033[?1000l");
+
+ tty_puts(tty, "\033[?1006l");
if (tty->mode & MODE_MOUSE_UTF8)
tty_puts(tty, "\033[?1005l");
}