summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/input-keys.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2011-04-19 21:31:33 +0000
committernicm <nicm@openbsd.org>2011-04-19 21:31:33 +0000
commit6b3bb719185a7dda28f2435d6bf7646e6b6cb932 (patch)
tree8a60735b4e9d64ba33992cd34089fb7f0e6f8f17 /usr.bin/tmux/input-keys.c
parentDisable the 88110 branch prediction logic unconditionnaly on all 88110 (diff)
downloadwireguard-openbsd-6b3bb719185a7dda28f2435d6bf7646e6b6cb932.tar.xz
wireguard-openbsd-6b3bb719185a7dda28f2435d6bf7646e6b6cb932.zip
When mode-mouse is on (it is off by default), automatically enter copy
mode when the mouse is dragged or the mouse wheel is used. Also exit copy mode when the mouse wheel is scrolled off the bottom. Discussed with and written by hsim at gmx dot li.
Diffstat (limited to 'usr.bin/tmux/input-keys.c')
-rw-r--r--usr.bin/tmux/input-keys.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.bin/tmux/input-keys.c b/usr.bin/tmux/input-keys.c
index 0c16317f51f..de09ad65468 100644
--- a/usr.bin/tmux/input-keys.c
+++ b/usr.bin/tmux/input-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input-keys.c,v 1.21 2011/01/03 23:35:21 nicm Exp $ */
+/* $OpenBSD: input-keys.c,v 1.22 2011/04/19 21:31:33 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -220,5 +220,12 @@ input_mouse(struct window_pane *wp, struct mouse_event *m)
buf[len++] = m->y + 33;
}
bufferevent_write(wp->event, buf, len);
+ } else if ((m->b & MOUSE_BUTTON) != MOUSE_2) {
+ if (options_get_number(&wp->window->options, "mode-mouse") &&
+ window_pane_set_mode(wp, &window_copy_mode) == 0) {
+ window_copy_init_from_pane(wp);
+ if (wp->mode->mouse != NULL)
+ wp->mode->mouse(wp, NULL, m);
+ }
}
}