mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-08 10:06:22 -05:00
fix cursor in alt grid programs
when vimode was launched in a full-terminal program (gdb, less, etc.), the cursor was always repositioned to the top of the screen.
This commit is contained in:
parent
a5cf270fdf
commit
48a748757e
1 changed files with 4 additions and 1 deletions
5
vimode.c
5
vimode.c
|
|
@ -73,6 +73,7 @@ static int cursor_from_scrollback_relative(struct terminal *const term, int row)
|
|||
{
|
||||
row = grid_row_sb_to_abs(term->grid, term->rows, row);
|
||||
row -= term->grid->offset;
|
||||
row &= (term->grid->num_rows - 1);
|
||||
return row;
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +118,7 @@ static void clip_cursor_to_view(struct terminal *const term)
|
|||
cursor_row = view_row + term->rows - 1;
|
||||
}
|
||||
term->vimode.cursor.row = cursor_from_scrollback_relative(term, cursor_row);
|
||||
LOG_DBG("CLIP CURSOR (%d, %d)\n", term->vimode.cursor.row,
|
||||
LOG_DBG("CLIP CURSOR (%d, %d)", term->vimode.cursor.row,
|
||||
term->vimode.cursor.col);
|
||||
damage_cursor_cell(term);
|
||||
render_refresh(term);
|
||||
|
|
@ -411,6 +412,8 @@ void vimode_begin(struct terminal *term)
|
|||
vimode_cancel(term);
|
||||
|
||||
term->vimode.cursor = term->grid->cursor.point;
|
||||
LOG_DBG("VIMODE CURSOR AT (%d, %d)", term->vimode.cursor.row,
|
||||
term->vimode.cursor.col);
|
||||
// From a user's perspective, it is reasonable to expect that the
|
||||
// mode will launch at the exact position in the scrollback they are
|
||||
// currently viewing, thus we move the cursor into the view.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue