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:
Daniel Eklöf 2023-04-12 16:39:54 +02:00
parent 98528da5e5
commit e2baa65238
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 6 additions and 5 deletions

View file

@ -4128,8 +4128,7 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
if (term->scroll_region.start >= term->rows)
term->scroll_region.start = 0;
if (term->scroll_region.end >= old_rows)
if (term->scroll_region.end > term->rows)
term->scroll_region.end = term->rows;
term->render.last_cursor.row = NULL;