From 8738141913517ae50d71b17ec531ce9f85dceb4d Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 19 Apr 2011 21:31:33 +0000 Subject: 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. --- input-keys.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'input-keys.c') 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); + } } } -- cgit v1.2.3