From 8ea09fc9086824ce45a2845f0ccd00da4fc63fde Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 29 Jun 2022 19:34:37 +0800 Subject: vim-patch:8.2.4378: incsearch HL broken when calling searchcount in 'tabLine' (#19147) Problem: Incsearch highlight broken when calling searchcount() in 'tabLine' function. (Mirko Palmer) Solution: Save and restore the incsearch state. (Christian Brabandt, closes vim/vim#9763, closes vim/vim#9633) https://github.com/vim/vim/commit/6dd7424c7e6ab81998c29ca3526c41b75cfde5a1 --- src/nvim/testdir/test_search_stat.vim | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search_stat.vim b/src/nvim/testdir/test_search_stat.vim index d950626615..89e09cf85b 100644 --- a/src/nvim/testdir/test_search_stat.vim +++ b/src/nvim/testdir/test_search_stat.vim @@ -370,6 +370,48 @@ func Test_search_stat_then_gd() call delete('Xsearchstatgd') endfunc +func Test_search_stat_and_incsearch() + CheckScreendump + + let lines =<< trim END + call setline(1, ['abc--c', '--------abc', '--abc']) + set hlsearch + set incsearch + set bg=dark + set showtabline=2 + + function MyTabLine() + try + let a=searchcount(#{recompute: 1, maxcount: -1}) + return a.current .. '/' .. a.total + catch + return '' + endtry + endfunction + + set tabline=%!MyTabLine() + END + call writefile(lines, 'Xsearchstat_inc') + + let buf = RunVimInTerminal('-S Xsearchstat_inc', #{rows: 10}) + call term_sendkeys(buf, "/abc") + call TermWait(buf) + call VerifyScreenDump(buf, 'Test_searchstat_inc_1', {}) + + call term_sendkeys(buf, "\") + call TermWait(buf) + call VerifyScreenDump(buf, 'Test_searchstat_inc_2', {}) + + call term_sendkeys(buf, "\") + call TermWait(buf) + call VerifyScreenDump(buf, 'Test_searchstat_inc_3', {}) + + call term_sendkeys(buf, "\:qa\") + call TermWait(buf) + + call StopVimInTerminal(buf) + call delete('Xsearchstat_inc') +endfunc " vim: shiftwidth=2 sts=2 expandtab -- cgit