diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-08-24 05:23:31 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-08-24 05:23:31 +0000 |
commit | 5bb81c4e3ebe4bbb4c25f2d74e906666deaa8d58 (patch) | |
tree | 42716b35ad207bc2fa5a0896e63d50f0a14ac38d /usr.bin | |
parent | 28b7cd6cf5c208fdaabd607728d1e3836e1f79ee (diff) |
Old Terminal.app versions do not respond correctly to secondary DA,
instead responding with the primary DA response. Ignore it. Reported by
Dave Vandervies.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/tty-keys.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c index d73a4756cbe..75324f0ac23 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.140 2020/07/06 07:27:39 nicm Exp $ */ +/* $OpenBSD: tty-keys.c,v 1.141 2020/08/24 05:23:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1192,7 +1192,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) @@ -1201,7 +1204,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); @@ -1219,6 +1222,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) { |