From 5509fe514afa64c972758ace3b81b462aba9694f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 17 Apr 2020 21:11:30 +0200 Subject: [PATCH] render: resize: no need to clear the selection - just truncate if necessary --- render.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/render.c b/render.c index ca0342f2..7b5391b6 100644 --- a/render.c +++ b/render.c @@ -1711,8 +1711,6 @@ maybe_resize(struct terminal *term, int width, int height, bool force) if (!force && width == term->width && height == term->height && scale == term->scale) return false; - selection_cancel(term); - /* Cancel an application initiated "Synchronized Update" */ term_disable_app_sync_updates(term); @@ -1814,6 +1812,12 @@ damage_view: term->height / term->scale + title_height); } + /* Make sure selection is within bounds */ + term->selection.start.row = min(term->selection.start.row, term->rows - 1); + term->selection.start.col = min(term->selection.start.col, term->cols - 1); + term->selection.end.row = min(term->selection.end.row, term->rows - 1); + term->selection.end.col = min(term->selection.end.col, term->cols - 1); + tll_free(term->normal.scroll_damage); tll_free(term->alt.scroll_damage);