summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2012-03-21 21:28:04 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2012-03-21 21:28:04 +0000
commit722ab03e127b6f3ca4e2a5dca1bc3494f621fe8a (patch)
treefd30c7083a6f743ba5315db177cd92715a6fe45e /usr.bin
parent6a404a949a3d0dd1c7a39bc7fb467ffb2f8816c6 (diff)
Some terminals respond to secondary DA with primary (they ignore the
intermediate character). So ignore the possible responses to primary DA.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/tty-keys.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c
index f5ce2b77359..e2ab32dc436 100644
--- a/usr.bin/tmux/tty-keys.c
+++ b/usr.bin/tmux/tty-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-keys.c,v 1.37 2012/03/17 22:56:04 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.38 2012/03/21 21:28:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -686,9 +686,9 @@ tty_keys_device(struct tty *tty, const char *buf, size_t len, size_t *size)
char tmp[64], *endptr;
/*
- * Secondary device attributes are \033[>a;b;c. We only request
- * attributes on xterm, so we only care about the middle values which
- * is the xterm version.
+ * Primary device attributes are \033[?a;b and secondary are
+ * \033[>a;b;c. We only request attributes on xterm, so we only care
+ * about the middle values which is the xterm version.
*/
*size = 0;
@@ -702,7 +702,7 @@ tty_keys_device(struct tty *tty, const char *buf, size_t len, size_t *size)
return (-1);
if (len == 2)
return (1);
- if (buf[2] != '>')
+ if (buf[2] != '>' && buf[2] != '?')
return (-1);
if (len == 3)
return (1);
@@ -718,6 +718,10 @@ tty_keys_device(struct tty *tty, const char *buf, size_t len, size_t *size)
tmp[i] = '\0';
*size = 4 + i;
+ /* Only secondary is of interest. */
+ if (buf[2] != '>')
+ return (0);
+
/* Convert version numbers. */
a = strtoul(tmp, &endptr, 10);
if (*endptr == ';') {