summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-10-10 11:49:43 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-10-10 11:49:43 +0000
commit0b9a96f3371a05f08e6e625faedb0b91c218554f (patch)
tree361d8c73ecb28b1905222ad7f54db3928724ef1a
parent4de1ad8446567fcd3880b418233c6f156de1ed4e (diff)
Handle input mouse positions <33 (we already can generate them).
-rw-r--r--usr.bin/tmux/tty-keys.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c
index bbd79bed376..f348c1aee16 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.59 2013/03/26 14:14:08 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.60 2013/10/10 11:49:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -676,11 +676,17 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size)
log_debug("mouse input: %.*s", (int) *size, buf);
/* Check and return the mouse input. */
- if (b < 32 || x < 33 || y < 33)
+ if (b < 32)
return (-1);
b -= 32;
- x -= 33;
- y -= 33;
+ if (x >= 33)
+ x -= 33;
+ else
+ x = 256 - x;
+ if (y >= 33)
+ y -= 33;
+ else
+ y = 256 - y;
} else if (buf[2] == '<') {
/* Read the three inputs. */
*size = 3;