mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-10 04:27:45 -05:00
fix selection changing start on mode change
This commit is contained in:
parent
fa2b08846b
commit
6e38cb683a
2 changed files with 9 additions and 7 deletions
|
|
@ -47,8 +47,10 @@ cmd_scrollback_up(struct terminal *term, int rows)
|
|||
view, new_view, offset, grid_rows);
|
||||
|
||||
selection_view_up(term, new_view);
|
||||
const int delta =
|
||||
(term->grid->view - new_view) & (term->grid->num_rows - 1);
|
||||
term->grid->view = new_view;
|
||||
vimode_view_up(term, 0);
|
||||
vimode_view_up(term, delta);
|
||||
|
||||
if (rows < term->rows) {
|
||||
term_damage_scroll(
|
||||
|
|
@ -102,8 +104,10 @@ cmd_scrollback_down(struct terminal *term, int rows)
|
|||
view, new_view, offset, grid_rows);
|
||||
|
||||
selection_view_down(term, new_view);
|
||||
const int delta =
|
||||
(new_view - term->grid->view) & (term->grid->num_rows - 1);
|
||||
term->grid->view = new_view;
|
||||
vimode_view_down(term, 0);
|
||||
vimode_view_down(term, delta);
|
||||
|
||||
if (rows < term->rows) {
|
||||
term_damage_scroll(
|
||||
|
|
|
|||
8
vimode.c
8
vimode.c
|
|
@ -458,17 +458,16 @@ void vimode_cancel(struct terminal *term)
|
|||
render_refresh(term);
|
||||
}
|
||||
|
||||
void vimode_view_up(struct terminal *term, int const delta)
|
||||
void vimode_view_up(struct terminal *const term, int const delta)
|
||||
{
|
||||
if (!term->vimode.active) {
|
||||
return;
|
||||
}
|
||||
|
||||
damage_cursor_cell(term);
|
||||
term->vimode.cursor.row += delta;
|
||||
clip_cursor_to_view(term);
|
||||
update_selection(term);
|
||||
update_highlights(term);
|
||||
term->vimode.selection.start.row += delta;
|
||||
}
|
||||
|
||||
void vimode_view_down(struct terminal *const term, int const delta)
|
||||
|
|
@ -477,11 +476,10 @@ void vimode_view_down(struct terminal *const term, int const delta)
|
|||
return;
|
||||
}
|
||||
|
||||
damage_cursor_cell(term);
|
||||
term->vimode.cursor.row -= delta;
|
||||
clip_cursor_to_view(term);
|
||||
update_selection(term);
|
||||
update_highlights(term);
|
||||
term->vimode.selection.start.row -= delta;
|
||||
}
|
||||
|
||||
static ssize_t matches_cell(const struct terminal *term,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue