diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-10-11 10:03:20 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-10-11 10:03:20 +0000 |
| commit | 2303affc8740ace55a9a546797653ddf244208f6 (patch) | |
| tree | 780cc1f960989db1bfbfed47dab81be18a72cc64 /input.c | |
| parent | readme/doc: add shift+insert to list of default key bindings (diff) | |
input: motion: scroll up/down while selecting
If the cursor moves above the grid top, or below the grid bottom,
while selecting text, scroll up/down the scrollback before updating
the selection.
TODO: this only scrolls when the mouse is *moved*. I.e. you can’t move
the cursor outside the grid once and for all, and then let foot
auto-scroll.
Diffstat (limited to 'input.c')
| -rw-r--r-- | input.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -1325,10 +1325,22 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer, = old_col != seat->mouse.col || old_row != seat->mouse.row; /* Cursor is inside the grid, i.e. *not* in the margins */ - bool cursor_is_on_grid = seat->mouse.col >= 0 && seat->mouse.row >= 0; + const bool cursor_is_on_grid = seat->mouse.col >= 0 && seat->mouse.row >= 0; + + const bool scroll_up = y < term->margins.top; + const bool scroll_down = y >= term->height - term->margins.bottom; /* Update selection */ if (!term->is_searching) { + + if (scroll_up || scroll_down) { + if (scroll_up) + cmd_scrollback_up(term, 1); + if (scroll_down) + cmd_scrollback_down(term, 1); + cursor_is_on_new_cell = true; + } + if (cursor_is_on_new_cell || term->selection.end.row < 0) selection_update(term, selection_col, selection_row); } |
