patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine'
Problem: Incsearch highlight broken when calling searchcount() in 'tabLine'
function. (Mirko Palmer)
Solution: Save and restore the incsearch state. (Christian Brabandt,
closes #9763, closes #9633)
diff --git a/src/search.c b/src/search.c
index 641d439..f4c2c87 100644
--- a/src/search.c
+++ b/src/search.c
@@ -325,6 +325,8 @@
static int did_save_last_search_spat = 0;
static int saved_last_idx = 0;
static int saved_no_hlsearch = 0;
+static int saved_search_match_endcol;
+static int saved_search_match_lines;
/*
* Save and restore the search pattern for incremental highlight search
@@ -370,6 +372,25 @@
set_no_hlsearch(saved_no_hlsearch);
}
+/*
+ * Save and restore the incsearch highlighting variables.
+ * This is required so that calling searchcount() at does not invalidate the
+ * incsearch highlighting.
+ */
+ static void
+save_incsearch_state(void)
+{
+ saved_search_match_endcol = search_match_endcol;
+ saved_search_match_lines = search_match_lines;
+}
+
+ static void
+restore_incsearch_state(void)
+{
+ search_match_endcol = saved_search_match_endcol;
+ search_match_lines = saved_search_match_lines;
+}
+
char_u *
last_search_pattern(void)
{
@@ -4182,6 +4203,9 @@
}
save_last_search_pattern();
+#ifdef FEAT_SEARCH_EXTRA
+ save_incsearch_state();
+#endif
if (pattern != NULL)
{
if (*pattern == NUL)
@@ -4202,6 +4226,9 @@
the_end:
restore_last_search_pattern();
+#ifdef FEAT_SEARCH_EXTRA
+ restore_incsearch_state();
+#endif
}
/*