aboutsummaryrefslogtreecommitdiff
path: root/search.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-07-22 15:53:29 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-07-22 15:57:43 +0000
commit251545203baa65364e491ddbe71ab3f8080bfe25 (patch)
tree04ae28511ffa429fdade04672815c253e2a2c4c6 /search.c
parentdoc: ctlseq: improve description of OSC 52 response (diff)
search: reset match state when selection is cancelled
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
Diffstat (limited to 'search.c')
-rw-r--r--search.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/search.c b/search.c
index 8f28a656..2db66cc9 100644
--- a/search.c
+++ b/search.c
@@ -155,6 +155,13 @@ search_cancel(struct terminal *term)
selection_cancel(term);
}
+void
+search_selection_cancelled(struct terminal *term)
+{
+ term->search.match = (struct coord){-1, -1};
+ term->search.match_len = 0;
+}
+
static void
search_update_selection(struct terminal *term,
int start_row, int start_col,