From 0b9a96f3371a05f08e6e625faedb0b91c218554f Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 10 Oct 2013 11:49:43 +0000 Subject: Handle input mouse positions <33 (we already can generate them). --- usr.bin/tmux/tty-keys.c | 14 ++++++++++---- 1 file 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 @@ -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; -- cgit v1.2.3