mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-20 05:33:47 -04:00
render: ensure scroll region’s endpoint is valid after a window resize
If we had a non-empty bottom scroll region, and the window was resized to a smaller size, the scroll region was not reset correctly. This led to a crash when scrolling the screen content. Fix by making sure the scroll region’s endpoint is within range.
This commit is contained in:
parent
98528da5e5
commit
e2baa65238
3 changed files with 6 additions and 5 deletions
|
|
@ -50,6 +50,8 @@
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
* Incorrect icon in dock and window switcher on Gnome ([#1317][1317])
|
* Incorrect icon in dock and window switcher on Gnome ([#1317][1317])
|
||||||
|
* Crash when scrolling after resizing the window with non-zero
|
||||||
|
scrolling regions.
|
||||||
|
|
||||||
[1317]: https://codeberg.org/dnkl/foot/issues/1317
|
[1317]: https://codeberg.org/dnkl/foot/issues/1317
|
||||||
|
|
||||||
|
|
|
||||||
3
render.c
3
render.c
|
|
@ -4128,8 +4128,7 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
|
||||||
|
|
||||||
if (term->scroll_region.start >= term->rows)
|
if (term->scroll_region.start >= term->rows)
|
||||||
term->scroll_region.start = 0;
|
term->scroll_region.start = 0;
|
||||||
|
if (term->scroll_region.end > term->rows)
|
||||||
if (term->scroll_region.end >= old_rows)
|
|
||||||
term->scroll_region.end = term->rows;
|
term->scroll_region.end = term->rows;
|
||||||
|
|
||||||
term->render.last_cursor.row = NULL;
|
term->render.last_cursor.row = NULL;
|
||||||
|
|
|
||||||
|
|
@ -2716,13 +2716,13 @@ term_scroll_partial(struct terminal *term, struct scroll_region region, int rows
|
||||||
erase_line(term, row);
|
erase_line(term, row);
|
||||||
}
|
}
|
||||||
|
|
||||||
term_damage_scroll(term, DAMAGE_SCROLL, region, rows);
|
|
||||||
term->grid->cur_row = grid_row(term->grid, term->grid->cursor.point.row);
|
|
||||||
|
|
||||||
#if defined(_DEBUG)
|
#if defined(_DEBUG)
|
||||||
for (int r = 0; r < term->rows; r++)
|
for (int r = 0; r < term->rows; r++)
|
||||||
xassert(grid_row(term->grid, r) != NULL);
|
xassert(grid_row(term->grid, r) != NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
term_damage_scroll(term, DAMAGE_SCROLL, region, rows);
|
||||||
|
term->grid->cur_row = grid_row(term->grid, term->grid->cursor.point.row);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue