From e2baa6523875aaa13b6b7db80b7985978b8ee492 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Wed, 12 Apr 2023 16:39:54 +0200 Subject: render: ensure scroll region’s endpoint is valid after a window resize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- terminal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index 04153513..2e62fbb7 100644 --- a/terminal.c +++ b/terminal.c @@ -2716,13 +2716,13 @@ term_scroll_partial(struct terminal *term, struct scroll_region region, int rows 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) for (int r = 0; r < term->rows; r++) xassert(grid_row(term->grid, r) != NULL); #endif + + term_damage_scroll(term, DAMAGE_SCROLL, region, rows); + term->grid->cur_row = grid_row(term->grid, term->grid->cursor.point.row); } void -- cgit v1.3