diff src/testdir/test_search.vim @ 14526:66b9514b5a99 v8.1.0276

patch 8.1.0276: no test for 'incsearch' highlighting with :s commit https://github.com/vim/vim/commit/164251ff805e89a3d9a850a77e3139e28908f44a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 12 16:26:58 2018 +0200 patch 8.1.0276: no test for 'incsearch' highlighting with :s Problem: No test for 'incsearch' highlighting with :s. Solution: Add a screendump test.
author Christian Brabandt <cb@256bit.org>
date Sun, 12 Aug 2018 16:30:05 +0200
parents e36d6e01708c
children 58ca11610819
line wrap: on
line diff
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -818,6 +818,41 @@ func Test_incsearch_substitute()
   call Incsearch_cleanup()
 endfunc
 
+" Similar to Test_incsearch_substitute() but with a screendump halfway.
+func Test_incsearch_substitute_dump()
+  if !exists('+incsearch')
+    return
+  endif
+  if !CanRunVimInTerminal()
+    return
+  endif
+  call writefile([
+	\ 'set incsearch hlsearch scrolloff=0',
+	\ 'for n in range(1, 10)',
+	\ '  call setline(n, "foo " . n)',
+	\ 'endfor',
+	\ '3',
+	\ ], 'Xis_subst_script')
+  let buf = RunVimInTerminal('-S Xis_subst_script', {'rows': 9, 'cols': 70})
+  " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by
+  " the 'ambiwidth' check.
+  sleep 100m
+
+  " Need to send one key at a time to force a redraw.
+  call term_sendkeys(buf, ':.,.+2s/')
+  sleep 100m
+  call term_sendkeys(buf, 'f')
+  sleep 100m
+  call term_sendkeys(buf, 'o')
+  sleep 100m
+  call term_sendkeys(buf, 'o')
+  call VerifyScreenDump(buf, 'Test_incsearch_substitute_01', {})
+
+  call term_sendkeys(buf, "\<Esc>")
+  call StopVimInTerminal(buf)
+  call delete('Xis_subst_script')
+endfunc
+
 func Test_search_undefined_behaviour()
   if !has("terminal")
     return