mirror of
https://github.com/tmux/tmux.git
synced 2025-11-04 17:46:05 +00:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user