Instead of forcing mouse scroll to 1 in choose mode, scale it down

instead. Means modifier keys still increase the line count, just not as
much. Based on a diff from Marcel Partap.
This commit is contained in:
nicm
2014-05-08 07:54:47 +00:00
parent 189017c078
commit 94ccc6aeaa
3 changed files with 18 additions and 10 deletions

View File

@ -721,17 +721,22 @@ window_choose_mouse(struct window_pane *wp, struct session *sess,
struct window_choose_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
struct window_choose_mode_item *item;
u_int idx;
u_int idx, i, n;
if (m->event == MOUSE_EVENT_WHEEL) {
/*
* Don't use m->scroll and just move line-by-line or it's
* annoying.
* Multiple line scrolling by default is annoying, so scale
* m->scroll back down.
*/
if (m->wheel == MOUSE_WHEEL_UP)
window_choose_key(wp, sess, KEYC_UP);
else
window_choose_key(wp, sess, KEYC_DOWN);
n = m->scroll;
if (n >= MOUSE_WHEEL_SCALE)
n /= MOUSE_WHEEL_SCALE;
for (i = 0; i < n; i++) {
if (m->wheel == MOUSE_WHEEL_UP)
window_choose_key(wp, sess, KEYC_UP);
else
window_choose_key(wp, sess, KEYC_DOWN);
}
return;
}