diff options
author | nicm <nicm> | 2020-08-24 05:23:30 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2020-09-30 13:33:02 +0100 |
commit | ec9e03d09a20ca00dd9d96f7938a2d03a504b535 (patch) | |
tree | 0c73dc4c80853bf0b93bd0fb59ec6c728af04721 | |
parent | 3bece648bd6f285959f90e58016fd9a636735e58 (diff) | |
download | rtmux-ec9e03d09a20ca00dd9d96f7938a2d03a504b535.tar.gz rtmux-ec9e03d09a20ca00dd9d96f7938a2d03a504b535.tar.bz2 rtmux-ec9e03d09a20ca00dd9d96f7938a2d03a504b535.zip |
Old Terminal.app versions do not respond correctly to secondary DA,
instead responding with the primary DA response. Ignore it. Reported by
Dave Vandervies.
-rw-r--r-- | tty-keys.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -1197,7 +1197,10 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len, if (tty->flags & TTY_HAVEDA) return (-1); - /* First three bytes are always \033[?. */ + /* + * First three bytes are always \033[>. Some older Terminal.app + * versions respond as for DA (\033[?) so accept and ignore that. + */ if (buf[0] != '\033') return (-1); if (len == 1) @@ -1206,7 +1209,7 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len, return (-1); if (len == 2) return (1); - if (buf[2] != '>') + if (buf[2] != '>' && buf[2] != '?') return (-1); if (len == 3) return (1); @@ -1224,6 +1227,10 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len, tmp[i] = '\0'; *size = 4 + i; + /* Ignore DA response. */ + if (buf[2] == '?') + return (0); + /* Convert all arguments to numbers. */ cp = tmp; while ((next = strsep(&cp, ";")) != NULL) { |