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.
This commit is contained in:
Tiago Cunha 2012-03-29 21:09:19 +00:00
parent bfc9f475c6
commit 407f66ccbc
1 changed files with 8 additions and 4 deletions

View File

@ -686,9 +686,9 @@ tty_keys_device(struct tty *tty, const char *buf, size_t len, size_t *size)
char tmp[64], *endptr; char tmp[64], *endptr;
/* /*
* Secondary device attributes are \033[>a;b;c. We only request * Primary device attributes are \033[?a;b and secondary are
* attributes on xterm, so we only care about the middle values which * \033[>a;b;c. We only request attributes on xterm, so we only care
* is the xterm version. * about the middle values which is the xterm version.
*/ */
*size = 0; *size = 0;
@ -702,7 +702,7 @@ tty_keys_device(struct tty *tty, const char *buf, size_t len, size_t *size)
return (-1); return (-1);
if (len == 2) if (len == 2)
return (1); return (1);
if (buf[2] != '>') if (buf[2] != '>' && buf[2] != '?')
return (-1); return (-1);
if (len == 3) if (len == 3)
return (1); return (1);
@ -718,6 +718,10 @@ tty_keys_device(struct tty *tty, const char *buf, size_t len, size_t *size)
tmp[i] = '\0'; tmp[i] = '\0';
*size = 4 + i; *size = 4 + i;
/* Only secondary is of interest. */
if (buf[2] != '>')
return (0);
/* Convert version numbers. */ /* Convert version numbers. */
a = strtoul(tmp, &endptr, 10); a = strtoul(tmp, &endptr, 10);
if (*endptr == ';') { if (*endptr == ';') {