aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2012-03-29 21:09:19 +0000
committerTiago Cunha <tcunha@gmx.com>2012-03-29 21:09:19 +0000
commit407f66ccbc10919ba8494abbd2c7b43954da0429 (patch)
tree185368ef7f9bc6df55986242e42df2a37d41956d
parentbfc9f475c6d21f3521c1aa62551f6033ecf30113 (diff)
downloadrtmux-407f66ccbc10919ba8494abbd2c7b43954da0429.tar.gz
rtmux-407f66ccbc10919ba8494abbd2c7b43954da0429.tar.bz2
rtmux-407f66ccbc10919ba8494abbd2c7b43954da0429.zip
Sync OpenBSD patchset 1078:
Some terminals respond to secondary DA with primary (they ignore the intermediate character). So ignore the possible responses to primary DA.
-rw-r--r--tty-keys.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tty-keys.c b/tty-keys.c
index 7d49229c..f31db0ac 100644
--- a/tty-keys.c
+++ b/tty-keys.c
@@ -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 == ';') {