diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2022-04-27 11:34:08 +0100 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2022-04-27 11:34:08 +0100 |
commit | c6b51cea923e0c4e92636998a776ada42511b6e5 (patch) | |
tree | a4f40113cca66cd1bf0612c86f9949b638691ca3 /tty-keys.c | |
parent | 58d1a206c6ae6b33059ea6b469c21dad92ea0841 (diff) | |
download | rtmux-c6b51cea923e0c4e92636998a776ada42511b6e5.tar.gz rtmux-c6b51cea923e0c4e92636998a776ada42511b6e5.tar.bz2 rtmux-c6b51cea923e0c4e92636998a776ada42511b6e5.zip |
If a mouse position was above the maximum supported by the normal mouse
protocol (223), tmux was allowing it to wrap around. However, since tmux was
not correctly handling this on input, other programs also do not handle it
correctly, and the alternative SGR mouse mode is now widespread, this seems
unnecessary, so remove this feature. Also define some constants to make it
clearer what the numbers mean. Mostly from Leonid S Usov in GitHub issue 3165.
Diffstat (limited to 'tty-keys.c')
-rw-r--r-- | tty-keys.c | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -1061,17 +1061,13 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size, log_debug("%s: mouse input: %.*s", c->name, (int)*size, buf); /* Check and return the mouse input. */ - if (b < 32) + if (b < MOUSE_PARAM_BTN_OFF || + x < MOUSE_PARAM_POS_OFF || + y < MOUSE_PARAM_POS_OFF) return (-1); - b -= 32; - if (x >= 33) - x -= 33; - else - x = 256 - x; - if (y >= 33) - y -= 33; - else - y = 256 - y; + b -= MOUSE_PARAM_BTN_OFF; + x -= MOUSE_PARAM_POS_OFF; + y -= MOUSE_PARAM_POS_OFF; } else if (buf[2] == '<') { /* Read the three inputs. */ *size = 3; |