mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-13 05:33:51 -04:00
render: resize: fix cursor positioning at grid wrap around
When current view is at a grid wrap around (last emitted row index is < grid offset), the cursor row ended up being negative which we then mapped to the top line. This is wrong. When we're at a wrap around, re-adjust cursor by adding the grid's row count.
This commit is contained in:
parent
8d262e71c1
commit
3ad2ee7681
1 changed files with 6 additions and 2 deletions
8
render.c
8
render.c
|
|
@ -1221,8 +1221,12 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
|
||||||
/* Position cursor at the last copied row */
|
/* Position cursor at the last copied row */
|
||||||
/* TODO: can we do better? */
|
/* TODO: can we do better? */
|
||||||
int cursor_row = term->grid == &term->normal
|
int cursor_row = term->grid == &term->normal
|
||||||
? last_normal_row - term->normal.offset - 1
|
? last_normal_row - term->normal.offset
|
||||||
: last_alt_row - term->alt.offset - 1;
|
: last_alt_row - term->alt.offset;
|
||||||
|
|
||||||
|
while (cursor_row < 0)
|
||||||
|
cursor_row += term->grid->num_rows;
|
||||||
|
cursor_row--;
|
||||||
|
|
||||||
term_cursor_to(
|
term_cursor_to(
|
||||||
term,
|
term,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue