summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/tty-keys.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2012-03-21 21:28:03 +0000
committernicm <nicm@openbsd.org>2012-03-21 21:28:03 +0000
commitcab6c0b3c01c1198c84c167286c1fa58f6267571 (patch)
tree807ef395aa662d1fb45fcf36f355c0a62e573366 /usr.bin/tmux/tty-keys.c
parentFix save-buffer usage, from Kazuhiko Sakaguchi. (diff)
downloadwireguard-openbsd-cab6c0b3c01c1198c84c167286c1fa58f6267571.tar.xz
wireguard-openbsd-cab6c0b3c01c1198c84c167286c1fa58f6267571.zip
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/tmux/tty-keys.c')
-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 == ';') {