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.
This commit is contained in:
Nicholas Marriott
2011-04-19 21:31:33 +00:00
parent 3970853feb
commit 8738141913
5 changed files with 46 additions and 21 deletions

View File

@ -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);
}
}
}