From 9e834a89df6a24c78bcc9d7c69175dd3ae684bdd Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Mon, 10 Aug 2020 19:06:51 +0800 Subject: vim-patch:8.1.0274: 'incsearch' triggers on ":source" Problem: 'incsearch' triggers on ":source". Solution: Check for the whole command name. https://github.com/vim/vim/commit/21f990e1c22ffa2fdb66a548ebbe25e6e7194776 --- src/nvim/testdir/test_search.vim | 87 ++++++++++++++++++++++++++++++---------- 1 file changed, 66 insertions(+), 21 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 087a261cca..7348c8c4e2 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -346,27 +346,6 @@ func Test_searchc() bw! endfunc -func Test_search_cmdline3() - throw 'skipped: Nvim does not support test_override()' - if !exists('+incsearch') - return - endif - " need to disable char_avail, - " so that expansion of commandline works - call test_override("char_avail", 1) - new - call setline(1, [' 1', ' 2 the~e', ' 3 the theother']) - set incsearch - 1 - " first match - call feedkeys("/the\\", 'tx') - call assert_equal(' 2 the~e', getline('.')) - " clean up - set noincsearch - call test_override("char_avail", 0) - bw! -endfunc - func Cmdline3_prep() throw 'skipped: Nvim does not support test_override()' " need to disable char_avail, @@ -384,6 +363,20 @@ func Cmdline3_cleanup() bw! endfunc +func Test_search_cmdline3() + throw 'skipped: Nvim does not support test_override()' + if !exists('+incsearch') + return + endif + call Cmdline3_prep() + 1 + " first match + call feedkeys("/the\\", 'tx') + call assert_equal(' 2 the~e', getline('.')) + + call Cmdline3_cleanup() +endfunc + func Test_search_cmdline3s() throw 'skipped: Nvim does not support test_override()' if !exists('+incsearch') @@ -393,6 +386,12 @@ func Test_search_cmdline3s() 1 call feedkeys(":%s/the\/xxx\", 'tx') call assert_equal(' 2 xxxe', getline('.')) + undo + call feedkeys(":%subs/the\/xxx\", 'tx') + call assert_equal(' 2 xxxe', getline('.')) + undo + call feedkeys(":%substitute/the\/xxx\", 'tx') + call assert_equal(' 2 xxxe', getline('.')) call Cmdline3_cleanup() endfunc @@ -406,6 +405,9 @@ func Test_search_cmdline3g() 1 call feedkeys(":g/the\/d\", 'tx') call assert_equal(' 3 the theother', getline(2)) + undo + call feedkeys(":global/the\/d\", 'tx') + call assert_equal(' 3 the theother', getline(2)) call Cmdline3_cleanup() endfunc @@ -420,6 +422,10 @@ func Test_search_cmdline3v() call feedkeys(":v/the\/d\", 'tx') call assert_equal(1, line('$')) call assert_equal(' 2 the~e', getline(1)) + undo + call feedkeys(":vglobal/the\/d\", 'tx') + call assert_equal(1, line('$')) + call assert_equal(' 2 the~e', getline(1)) call Cmdline3_cleanup() endfunc @@ -480,6 +486,45 @@ func Test_search_cmdline5() bw! endfunc +func Test_search_cmdline7() + throw 'skipped: Nvim does not support test_override()' + " Test that an pressing in an empty command line + " does not move the cursor + if !exists('+incsearch') + return + endif + " need to disable char_avail, + " so that expansion of commandline works + call test_override("char_avail", 1) + new + let @/ = 'b' + call setline(1, [' bbvimb', '']) + set incsearch + " first match + norm! gg0 + " moves to next match of previous search pattern, just like / + call feedkeys("/\\", 'tx') + call assert_equal([0,1,2,0], getpos('.')) + " moves to next match of previous search pattern, just like / + call feedkeys("/\", 'tx') + call assert_equal([0,1,3,0], getpos('.')) + " moves to next match of previous search pattern, just like / + call feedkeys("/\\", 'tx') + call assert_equal([0,1,7,0], getpos('.')) + + " using an offset uses the last search pattern + call cursor(1, 1) + call setline(1, ['1 bbvimb', ' 2 bbvimb']) + let @/ = 'b' + call feedkeys("//e\\", 'tx') + call assert_equal('1 bbvimb', getline('.')) + call assert_equal(4, col('.')) + + set noincsearch + call test_override("char_avail", 0) + bw! +endfunc + " Tests for regexp with various magic settings func Test_search_regexp() enew! -- cgit