diff src/testdir/test_search_stat.vim @ 27704:4c68fb88b73f v8.2.4378

patch 8.2.4378: incsearch HL broken when calling searchcount in 'tabLine' Commit: https://github.com/vim/vim/commit/6dd7424c7e6ab81998c29ca3526c41b75cfde5a1 Author: Christian Brabandt <cb@256bit.org> Date: Mon Feb 14 12:44:32 2022 +0000 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)
author Bram Moolenaar <Bram@vim.org>
date Mon, 14 Feb 2022 13:45:02 +0100
parents 95d6e3c9aa1e
children 86eb4aba16c3
line wrap: on
line diff
--- a/src/testdir/test_search_stat.vim
+++ b/src/testdir/test_search_stat.vim
@@ -371,6 +371,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, "\<c-g>")
+  call TermWait(buf)
+  call VerifyScreenDump(buf, 'Test_searchstat_inc_2', {})
+
+  call term_sendkeys(buf, "\<c-g>")
+  call TermWait(buf)
+  call VerifyScreenDump(buf, 'Test_searchstat_inc_3', {})
+
+  call term_sendkeys(buf, "\<esc>:qa\<cr>")
+  call TermWait(buf)
+
+  call StopVimInTerminal(buf)
+  call delete('Xsearchstat_inc')
+endfunc
 
 
 " vim: shiftwidth=2 sts=2 expandtab