aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-07-22 19:34:25 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-07-22 19:34:25 +0000
commit14737d1d829615926ed79468b331e7f7aa57e1b1 (patch)
tree6adca3f6d5675e2c6a59596a0fc06e7346811fa4
parentdoc: ctlseq: improve description of OSC 52 response (diff)
parentsearch: redraw search box after selection has been cancelled (diff)
Merge branch 'search-crash-when-selection-is-cancelled'
Closes #644
-rw-r--r--CHANGELOG.md3
-rw-r--r--search.c8
-rw-r--r--search.h2
-rw-r--r--selection.c3
4 files changed, 16 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index acb30d6f..c9dfdecb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -39,6 +39,9 @@
* Rendering into the right margin area with `tweak.overflowing-glyphs`
enabled.
* PGO builds with clang (https://codeberg.org/dnkl/foot/issues/642).
+* Crash in scrollback search mode when selection has been canceled due
+ to terminal content updates
+ (https://codeberg.org/dnkl/foot/issues/644).
### Security
diff --git a/search.c b/search.c
index 8f28a656..817f18b5 100644
--- a/search.c
+++ b/search.c
@@ -155,6 +155,14 @@ 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;
+ render_refresh_search(term);
+}
+
static void
search_update_selection(struct terminal *term,
int start_row, int start_col,
diff --git a/search.h b/search.h
index 5db1610d..f4dfa5b9 100644
--- a/search.h
+++ b/search.h
@@ -11,3 +11,5 @@ void search_input(
const xkb_keysym_t *raw_syms, size_t raw_count,
uint32_t serial);
void search_add_chars(struct terminal *term, const char *text, size_t len);
+
+void search_selection_cancelled(struct terminal *term);
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