From 251545203baa65364e491ddbe71ab3f8080bfe25 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 22 Jul 2021 17:53:29 +0200 Subject: search: reset match state when selection is cancelled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While we’re in scrollback search mode, the selection may be cancelled (for example, if the application is scrolling out the selected text). Trying to e.g. extend the search selection after this has happened triggered a crash. This fixes it by simply resetting the search match state when the selection is cancelled. Closes #644 --- selection.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'selection.c') diff --git a/selection.c b/selection.c index 537614f6..95879445 100644 --- a/selection.c +++ b/selection.c @@ -21,6 +21,7 @@ #include "grid.h" #include "misc.h" #include "render.h" +#include "search.h" #include "uri.h" #include "util.h" #include "vt.h" @@ -1058,6 +1059,8 @@ selection_cancel(struct terminal *term) term->selection.pivot.end = (struct coord){-1, -1}; term->selection.direction = SELECTION_UNDIR; term->selection.ongoing = false; + + search_selection_cancelled(term); } bool -- cgit v1.3