summaryrefslogtreecommitdiffstats
path: root/window-copy.c
diff options
context:
space:
mode:
authornicm <nicm>2014-04-03 08:20:29 +0000
committernicm <nicm>2014-04-03 08:20:29 +0000
commitacef311fe356f408690e9f94727ed63a934b742f (patch)
treede04ad3fd0267ac02a8fd127aaf802b4287d2b45 /window-copy.c
parent8824dae6f7b21f95ea824ecc1abc31140763c971 (diff)
Work out mouse scroll wheel effect when the mouse is first detected and
store it in struct mouse_event, reduce the scroll size the 3 but allow shift to reduce it to 1 and meta and ctrl to multiply by 3 if the terminal supports them, also support wheel in choose mode. From Marcel Partap.
Diffstat (limited to 'window-copy.c')
-rw-r--r--window-copy.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/window-copy.c b/window-copy.c
index 7d7f3a20..6e4d6704 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -871,18 +871,19 @@ window_copy_mouse(
/* If mouse wheel (buttons 4 and 5), scroll. */
if (m->event == MOUSE_EVENT_WHEEL) {
- if (m->wheel == MOUSE_WHEEL_UP) {
- for (i = 0; i < 5; i++)
+ for (i = 0; i < m->scroll; i++) {
+ if (m->wheel == MOUSE_WHEEL_UP)
window_copy_cursor_up(wp, 1);
- } else if (m->wheel == MOUSE_WHEEL_DOWN) {
- for (i = 0; i < 5; i++)
+ else {
window_copy_cursor_down(wp, 1);
- /*
- * We reached the bottom, leave copy mode,
- * but only if no selection is in progress.
- */
- if (data->oy == 0 && !s->sel.flag)
- goto reset_mode;
+
+ /*
+ * We reached the bottom, leave copy mode, but
+ * only if no selection is in progress.
+ */
+ if (data->oy == 0 && !s->sel.flag)
+ goto reset_mode;
+ }
}
return;
}