mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
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.
This commit is contained in:
parent
c650862b0d
commit
2303affc87
1 changed files with 13 additions and 1 deletions
14
input.c
14
input.c
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue