summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-11-09 10:54:28 +0000
committernicm <nicm@openbsd.org>2020-11-09 10:54:28 +0000
commit3b75f6c761d8407a9c4e70201d5b7b785444e751 (patch)
tree91f34c85eb79392935d40c17d2568ed6930c894f
parentChange how escaping is processed for formats so that ## and # can be (diff)
downloadwireguard-openbsd-3b75f6c761d8407a9c4e70201d5b7b785444e751.tar.xz
wireguard-openbsd-3b75f6c761d8407a9c4e70201d5b7b785444e751.zip
If mouse bits change, clear them all and set again to avoid problems
with some bits implying others. GitHub issue 2458.
-rw-r--r--usr.bin/tmux/tty.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 2d84b7a23ad..cebde9d97d5 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.385 2020/10/05 09:53:01 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.386 2020/11/09 10:54:28 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -694,28 +694,26 @@ tty_update_mode(struct tty *tty, int mode, struct screen *s)
}
if ((changed & ALL_MOUSE_MODES) &&
tty_term_has(tty->term, TTYC_KMOUS)) {
- if ((mode & ALL_MOUSE_MODES) == 0)
+ /*
+ * If the mouse modes have changed, clear any that are set and
+ * apply again. There are differences in how terminals track
+ * the various bits.
+ */
+ if (tty->mode & MODE_MOUSE_SGR)
tty_puts(tty, "\033[?1006l");
- if ((changed & MODE_MOUSE_STANDARD) &&
- (~mode & MODE_MOUSE_STANDARD))
+ if (tty->mode & MODE_MOUSE_STANDARD)
tty_puts(tty, "\033[?1000l");
- if ((changed & MODE_MOUSE_BUTTON) &&
- (~mode & MODE_MOUSE_BUTTON))
+ if (tty->mode & MODE_MOUSE_BUTTON)
tty_puts(tty, "\033[?1002l");
- if ((changed & MODE_MOUSE_ALL) &&
- (~mode & MODE_MOUSE_ALL))
+ if (tty->mode & MODE_MOUSE_ALL)
tty_puts(tty, "\033[?1003l");
-
if (mode & ALL_MOUSE_MODES)
tty_puts(tty, "\033[?1006h");
- if ((changed & MODE_MOUSE_STANDARD) &&
- (mode & MODE_MOUSE_STANDARD))
+ if (mode & MODE_MOUSE_STANDARD)
tty_puts(tty, "\033[?1000h");
- if ((changed & MODE_MOUSE_BUTTON) &&
- (mode & MODE_MOUSE_BUTTON))
+ if (mode & MODE_MOUSE_BUTTON)
tty_puts(tty, "\033[?1002h");
- if ((changed & MODE_MOUSE_ALL) &&
- (mode & MODE_MOUSE_ALL))
+ if (mode & MODE_MOUSE_ALL)
tty_puts(tty, "\033[?1003h");
}
if (changed & MODE_BRACKETPASTE) {