Sync OpenBSD patchset 896:

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:
Tiago Cunha
2011-04-25 20:33:42 +00:00
parent d5150484d1
commit 215ee46106
5 changed files with 52 additions and 27 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: input-keys.c,v 1.48 2011-01-07 14:34:45 tcunha Exp $ */
/* $Id: input-keys.c,v 1.49 2011-04-25 20:33:42 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -219,5 +219,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);
}
}
}