1
0
forked from aniani/vim

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)
This commit is contained in:
Christian Brabandt
2022-02-14 12:44:32 +00:00
committed by Bram Moolenaar
parent 0cd3e94e2c
commit 6dd7424c7e
6 changed files with 101 additions and 0 deletions

View File

@@ -325,6 +325,8 @@ static spat_T saved_last_search_spat;
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 @@ restore_last_search_pattern(void)
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 @@ f_searchcount(typval_T *argvars, typval_T *rettv)
}
save_last_search_pattern();
#ifdef FEAT_SEARCH_EXTRA
save_incsearch_state();
#endif
if (pattern != NULL)
{
if (*pattern == NUL)
@@ -4202,6 +4226,9 @@ f_searchcount(typval_T *argvars, typval_T *rettv)
the_end:
restore_last_search_pattern();
#ifdef FEAT_SEARCH_EXTRA
restore_incsearch_state();
#endif
}
/*