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 --- test/functional/legacy/search_stat_spec.lua | 63 +++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/search_stat_spec.lua b/test/functional/legacy/search_stat_spec.lua index fdd46c0cb9..c2ca393a56 100644 --- a/test/functional/legacy/search_stat_spec.lua +++ b/test/functional/legacy/search_stat_spec.lua @@ -12,6 +12,7 @@ describe('search stat', function() [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText [2] = {background = Screen.colors.Yellow}, -- Search [3] = {foreground = Screen.colors.Blue4, background = Screen.colors.LightGrey}, -- Folded + [4] = {reverse = true}, -- IncSearch, TabLineFill }) screen:attach() end) @@ -118,4 +119,66 @@ describe('search stat', function() | ]]) end) + + it('is not broken by calling searchcount() in tabline vim-patch:8.2.4378', function() + exec([[ + call setline(1, ['abc--c', '--------abc', '--abc']) + set hlsearch + set incsearch + 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() + ]]) + + feed('/abc') + screen:expect([[ + {4: }| + {2:abc}--c | + --------{4:abc} | + --{2:abc} | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + /abc^ | + ]]) + + feed('') + screen:expect([[ + {4:3/3 }| + {2:abc}--c | + --------{2:abc} | + --{4:abc} | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + /abc^ | + ]]) + + feed('') + screen:expect([[ + {4:1/3 }| + {4:abc}--c | + --------{2:abc} | + --{2:abc} | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + /abc^ | + ]]) + end) end) -- cgit