diff src/testdir/test_search.vim @ 28399:d395fadbaf67 v8.2.4724

patch 8.2.4724: current instance of last search pattern not easily spotted Commit: https://github.com/vim/vim/commit/a43993897aa372159f682df37562f159994dc85c Author: LemonBoy <thatlemon@gmail.com> Date: Sat Apr 9 21:04:08 2022 +0100 patch 8.2.4724: current instance of last search pattern not easily spotted Problem: Current instance of last search pattern not easily spotted. Solution: Add CurSearch highlighting. (closes https://github.com/vim/vim/issues/10133)
author Bram Moolenaar <Bram@vim.org>
date Sat, 09 Apr 2022 22:15:03 +0200
parents 6f43253463cc
children 9ff0e5a29037
line wrap: on
line diff
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -1038,6 +1038,34 @@ func Test_incsearch_substitute_long_line
   bwipe!
 endfunc
 
+func Test_hlsearch_cursearch()
+  CheckScreendump
+
+  let lines =<< trim END
+    set hlsearch scrolloff=0
+    call setline(1, ['one', 'foo', 'bar', 'baz', 'foo', 'bar'])
+    hi Search ctermbg=yellow
+    hi CurSearch ctermbg=blue
+  END
+  call writefile(lines, 'Xhlsearch_cursearch')
+  let buf = RunVimInTerminal('-S Xhlsearch_cursearch', {'rows': 9, 'cols': 60})
+
+  call term_sendkeys(buf, "gg/foo\<CR>")
+  call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_single_line_1', {})
+
+  call term_sendkeys(buf, "n")
+  call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_single_line_2', {})
+
+  call term_sendkeys(buf, "?\<CR>")
+  call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_single_line_3', {})
+
+  call term_sendkeys(buf, "gg/foo\\nbar\<CR>")
+  call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_multiple_line', {})
+
+  call StopVimInTerminal(buf)
+  call delete('Xhlsearch_cursearch')
+endfunc
+
 " Similar to Test_incsearch_substitute() but with a screendump halfway.
 func Test_incsearch_substitute_dump()
   CheckOption incsearch