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. --- render.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index f16898b4..d39c9489 100644 --- a/render.c +++ b/render.c @@ -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; -- cgit v1.3