summaryrefslogtreecommitdiffstats
path: root/input-keys.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2011-04-19 21:31:33 +0000
committerNicholas Marriott <nicm@openbsd.org>2011-04-19 21:31:33 +0000
commit8738141913517ae50d71b17ec531ce9f85dceb4d (patch)
tree39260de50a4aa580a043ed1534c70969f59aecff /input-keys.c
parent3970853febf1a371d68d27c331e81a2afe1a63bb (diff)
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 'input-keys.c')
-rw-r--r--input-keys.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/input-keys.c b/input-keys.c
index f73ce397..dfcc8273 100644
--- a/input-keys.c
+++ b/input-keys.c
@@ -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);
+ }
}
}