diff src/testdir/test_search.vim @ 13790:dd6a63e3e7c4 v8.0.1767

patch 8.0.1767: with 'incsearch' text may jump up and down commit https://github.com/vim/vim/commit/9d34d90210ba52ebaf45973282e5921f5af364c7 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Apr 27 22:18:12 2018 +0200 patch 8.0.1767: with 'incsearch' text may jump up and down Problem: With 'incsearch' text may jump up and down. () Solution: Besides w_botline also save and restore w_empty_rows. (closes # 2530)
author Christian Brabandt <cb@256bit.org>
date Fri, 27 Apr 2018 22:30:06 +0200
parents fe0cec169589
children 16a062cf08c2
line wrap: on
line diff
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -1,6 +1,7 @@
 " Test for the search command
 
 source shared.vim
+source screendump.vim
 
 func Test_search_cmdline()
   if !exists('+incsearch')
@@ -690,6 +691,36 @@ func Test_search_cmdline_incsearch_highl
   bwipe!
 endfunc
 
+func Test_incsearch_scrolling()
+  if !CanRunVimInTerminal()
+    return
+  endif
+  call assert_equal(0, &scrolloff)
+  call writefile([
+	\ 'let dots = repeat(".", 120)',
+	\ 'set incsearch cmdheight=2 scrolloff=0',
+	\ 'call setline(1, [dots, dots, dots, "", "target", dots, dots])',
+	\ 'normal gg',
+	\ 'redraw',
+	\ ], 'Xscript')
+  let buf = RunVimInTerminal('-S Xscript', {'rows': 9, 'cols': 70})
+  " Need to send one key at a time to force a redraw
+  call term_sendkeys(buf, '/')
+  sleep 100m
+  call term_sendkeys(buf, 't')
+  sleep 100m
+  call term_sendkeys(buf, 'a')
+  sleep 100m
+  call term_sendkeys(buf, 'r')
+  sleep 100m
+  call term_sendkeys(buf, 'g')
+  call VerifyScreenDump(buf, 'Test_incsearch_scrolling_01', {})
+
+  call term_sendkeys(buf, "\<Esc>")
+  call StopVimInTerminal(buf)
+  call delete('Xscript')
+endfunc
+
 func Test_search_undefined_behaviour()
   if !has("terminal")
     return