diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/legacy/search_spec.lua | 33 | ||||
-rw-r--r-- | test/old/testdir/test_search.vim | 25 |
2 files changed, 55 insertions, 3 deletions
diff --git a/test/functional/legacy/search_spec.lua b/test/functional/legacy/search_spec.lua index 4228940eda..e2544a8405 100644 --- a/test/functional/legacy/search_spec.lua +++ b/test/functional/legacy/search_spec.lua @@ -642,7 +642,7 @@ describe('search cmdline', function() end) -- oldtest: Test_incsearch_substitute_dump2() - it('detects empty pattern properly vim-patch:8.2.2295', function() + it('incsearch detects empty pattern properly vim-patch:8.2.2295', function() screen:try_resize(70, 6) exec([[ set incsearch hlsearch scrolloff=0 @@ -675,6 +675,37 @@ describe('search cmdline', function() :1,5s/\v|^ | ]]) end) + + -- oldtest: Test_incsearch_restore_view() + it('incsearch restores viewport', function() + screen:try_resize(20, 6) + exec([[ + set incsearch nohlsearch + setlocal scrolloff=0 smoothscroll + call setline(1, [join(range(25), ' '), '', '', '', '', 'xxx']) + call feedkeys("2\<C-E>", 't') + ]]) + local s = [[ + {tilde:<<<} 18 19 20 21 22 2| + ^3 24 | + | + | + | + | + ]] + screen:expect(s) + feed('/xxx') + screen:expect([[ + | + | + | + | + {inc:xxx} | + /xxx^ | + ]]) + feed('<Esc>') + screen:expect(s) + end) end) describe('Search highlight', function() diff --git a/test/old/testdir/test_search.vim b/test/old/testdir/test_search.vim index 37909d0afe..abbb9cd46d 100644 --- a/test/old/testdir/test_search.vim +++ b/test/old/testdir/test_search.vim @@ -1996,7 +1996,7 @@ func Test_incsearch_substitute_dump2() \ 'endfor', \ 'call setline(5, "abc|def")', \ '3', - \ ], 'Xis_subst_script2') + \ ], 'Xis_subst_script2', 'D') let buf = RunVimInTerminal('-S Xis_subst_script2', {'rows': 9, 'cols': 70}) call term_sendkeys(buf, ':%s/\vabc|') @@ -2011,7 +2011,28 @@ func Test_incsearch_substitute_dump2() call StopVimInTerminal(buf) - call delete('Xis_subst_script2') +endfunc + +func Test_incsearch_restore_view() + CheckOption incsearch + CheckScreendump + + let lines =<< trim [CODE] + set incsearch nohlsearch + setlocal scrolloff=0 smoothscroll + call setline(1, [join(range(25), ' '), '', '', '', '', 'xxx']) + call feedkeys("2\<C-E>", 't') + [CODE] + call writefile(lines, 'Xincsearch_restore_view', 'D') + let buf = RunVimInTerminal('-S Xincsearch_restore_view', {'rows': 6, 'cols': 20}) + + call VerifyScreenDump(buf, 'Test_incsearch_restore_view_01', {}) + call term_sendkeys(buf, '/xxx') + call VerifyScreenDump(buf, 'Test_incsearch_restore_view_02', {}) + call term_sendkeys(buf, "\<Esc>") + call VerifyScreenDump(buf, 'Test_incsearch_restore_view_01', {}) + + call StopVimInTerminal(buf) endfunc func Test_pattern_is_uppercase_smartcase() |