From a05eaf28bdeea793829bddb6cc99220b1adb1d6f Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 28 Jul 2022 18:27:13 +0200 Subject: selection: selection_on_rows(): use scrollback relative coords MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When checking if the current selection intersects with the region (passed as parameter to the function), use scrollback relative coordinates. This fixes an issue where selections crossing the scrollback wrap-around being misdetected, resulting in either the selection being canceled while scrolling, even though it wasn’t scrolled out, or the selection _not_ being canceled, when it _was_ scrolled out. --- terminal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index dd84b8cf..0763fb52 100644 --- a/terminal.c +++ b/terminal.c @@ -2537,11 +2537,11 @@ term_scroll_partial(struct terminal *term, struct scroll_region region, int rows * scrolled in (i.e. re-used lines). */ if (selection_on_top_region(term, region) || - selection_on_bottom_region(term, region) || - selection_on_rows(term, region.end - rows, region.end - 1)) + selection_on_bottom_region(term, region)) { selection_cancel(term); - } + } else + selection_scroll_up(term, rows); } sixel_scroll_up(term, rows); @@ -2611,11 +2611,11 @@ term_scroll_reverse_partial(struct terminal *term, * scrolled in (i.e. re-used lines). */ if (selection_on_top_region(term, region) || - selection_on_bottom_region(term, region) || - selection_on_rows(term, region.start, region.start + rows - 1)) + selection_on_bottom_region(term, region)) { selection_cancel(term); - } + } else + selection_scroll_down(term, rows); } sixel_scroll_down(term, rows); -- cgit v1.3