=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tty-keys.c,v retrieving revision 1.119 retrieving revision 1.120 diff -u -r1.119 -r1.120 --- src/usr.bin/tmux/tty-keys.c 2020/01/12 22:00:20 1.119 +++ src/usr.bin/tmux/tty-keys.c 2020/01/13 08:12:53 1.120 @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-keys.c,v 1.119 2020/01/12 22:00:20 nicm Exp $ */ +/* $OpenBSD: tty-keys.c,v 1.120 2020/01/13 08:12:53 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1020,6 +1020,8 @@ int flags = 0; *size = 0; + if (tty->flags & TTY_HAVEDA) + return (-1); /* First three bytes are always \033[?. */ if (buf[0] != '\033') @@ -1064,7 +1066,10 @@ for (i = 1; i < n; i++) log_debug("%s: DA feature: %d", c->name, p[i]); log_debug("%s: received DA %.*s", c->name, (int)*size, buf); + tty_set_flags(tty, flags); + tty->flags |= TTY_HAVEDA; + return (0); } @@ -1082,6 +1087,8 @@ int flags = 0; *size = 0; + if (tty->flags & TTY_HAVEDSR) + return (-1); /* First three bytes are always \033[. */ if (buf[0] != '\033') @@ -1092,6 +1099,10 @@ return (-1); if (len == 2) return (1); + if (buf[2] != 'I') + return (-1); + if (len == 3) + return (1); /* Copy the rest up to a 'n'. */ for (i = 0; i < (sizeof tmp) - 1 && buf[2 + i] != 'n'; i++) { @@ -1108,6 +1119,9 @@ if (strncmp(tmp, "ITERM2 ", 7) == 0) flags |= TERM_DECSLRM; log_debug("%s: received DSR %.*s", c->name, (int)*size, buf); + tty_set_flags(tty, flags); + tty->flags |= TTY_HAVEDSR; + return (0); }