From e8a8b9ed08405c830a049c4e43910c5ce9cdb669 Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Mon, 10 Aug 2020 03:02:54 +0800 Subject: vim-patch:8.1.0271: 'incsearch' doesn't work for :s, :g or :v Problem: 'incsearch' doesn't work for :s, :g or :v. Solution: Also use 'incsearch' for other commands that use a pattern. https://github.com/vim/vim/commit/b0acacd767a2b0618a7f3c08087708f4329580d0 --- src/nvim/testdir/test_search.vim | 57 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 8036dea29f..087a261cca 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -367,6 +367,63 @@ func Test_search_cmdline3() bw! endfunc +func Cmdline3_prep() + throw 'skipped: Nvim does not support test_override()' + " 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 +endfunc + +func Cmdline3_cleanup() + throw 'skipped: Nvim does not support test_override()' + set noincsearch + call test_override("char_avail", 0) + bw! +endfunc + +func Test_search_cmdline3s() + throw 'skipped: Nvim does not support test_override()' + if !exists('+incsearch') + return + endif + call Cmdline3_prep() + 1 + call feedkeys(":%s/the\/xxx\", 'tx') + call assert_equal(' 2 xxxe', getline('.')) + + call Cmdline3_cleanup() +endfunc + +func Test_search_cmdline3g() + throw 'skipped: Nvim does not support test_override()' + if !exists('+incsearch') + return + endif + call Cmdline3_prep() + 1 + call feedkeys(":g/the\/d\", 'tx') + call assert_equal(' 3 the theother', getline(2)) + + call Cmdline3_cleanup() +endfunc + +func Test_search_cmdline3v() + throw 'skipped: Nvim does not support test_override()' + if !exists('+incsearch') + return + endif + call Cmdline3_prep() + 1 + call feedkeys(":v/the\/d\", 'tx') + call assert_equal(1, line('$')) + call assert_equal(' 2 the~e', getline(1)) + + call Cmdline3_cleanup() +endfunc + func Test_search_cmdline4() " See test/functional/legacy/search_spec.lua throw 'skipped: Nvim does not support test_override()' -- cgit 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 From dd08f6367b9ecd231028ee19b479b5ad723458e4 Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Mon, 10 Aug 2020 19:15:57 +0800 Subject: vim-patch:8.1.0275: 'incsearch' with :s doesn't start at cursor line Problem: 'incsearch' with :s doesn't start at cursor line. Solution: Set cursor before parsing address. (closes vim/vim#3318) Also accept a match at the start of the first line. https://github.com/vim/vim/commit/976b847f43dd16eb6cd809d2dcab7dde6045e176 --- src/nvim/testdir/test_search.vim | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 7348c8c4e2..333f5807fd 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -356,7 +356,7 @@ func Cmdline3_prep() set incsearch endfunc -func Cmdline3_cleanup() +func Incsearch_cleanup() throw 'skipped: Nvim does not support test_override()' set noincsearch call test_override("char_avail", 0) @@ -374,7 +374,7 @@ func Test_search_cmdline3() call feedkeys("/the\\", 'tx') call assert_equal(' 2 the~e', getline('.')) - call Cmdline3_cleanup() + call Incsearch_cleanup() endfunc func Test_search_cmdline3s() @@ -393,7 +393,7 @@ func Test_search_cmdline3s() call feedkeys(":%substitute/the\/xxx\", 'tx') call assert_equal(' 2 xxxe', getline('.')) - call Cmdline3_cleanup() + call Incsearch_cleanup() endfunc func Test_search_cmdline3g() @@ -409,7 +409,7 @@ func Test_search_cmdline3g() call feedkeys(":global/the\/d\", 'tx') call assert_equal(' 3 the theother', getline(2)) - call Cmdline3_cleanup() + call Incsearch_cleanup() endfunc func Test_search_cmdline3v() @@ -427,7 +427,7 @@ func Test_search_cmdline3v() call assert_equal(1, line('$')) call assert_equal(' 2 the~e', getline(1)) - call Cmdline3_cleanup() + call Incsearch_cleanup() endfunc func Test_search_cmdline4() @@ -682,6 +682,28 @@ func Test_incsearch_scrolling() call delete('Xscript') endfunc +func Test_incsearch_substitute() + throw 'skipped: Nvim does not support test_override()' + if !exists('+incsearch') + return + endif + call test_override("char_avail", 1) + new + set incsearch + for n in range(1, 10) + call setline(n, 'foo ' . n) + endfor + 4 + call feedkeys(":.,.+2s/foo\o\o/xxx\", 'tx') + call assert_equal('foo 3', getline(3)) + call assert_equal('xxx 4', getline(4)) + call assert_equal('xxx 5', getline(5)) + call assert_equal('xxx 6', getline(6)) + call assert_equal('foo 7', getline(7)) + + call Incsearch_cleanup() +endfunc + func Test_search_undefined_behaviour() if !has("terminal") return -- cgit From 50da4d4f451c24f53189a66b653236ac72cd2353 Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Mon, 10 Aug 2020 20:36:56 +0800 Subject: vim-patch:8.1.0277: 'incsearch' highlighting wrong in a few cases Problem: 'incsearch' highlighting wrong in a few cases. Solution: Fix using last search pattern. Restore highlighting when changing command. (issue vim/vim#3321) https://github.com/vim/vim/commit/c7f08b7ee1c1ff2080d425c2fcdb6907c26fc98e --- src/nvim/testdir/test_search.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 333f5807fd..c2093f47fd 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -614,6 +614,7 @@ func Test_incsearch_substitute_dump() sleep 100m " Need to send one key at a time to force a redraw. + " Select three lines at the cursor with typed pattern. call term_sendkeys(buf, ':.,.+2s/') sleep 100m call term_sendkeys(buf, 'f') @@ -621,7 +622,21 @@ func Test_incsearch_substitute_dump() call term_sendkeys(buf, 'o') sleep 100m call term_sendkeys(buf, 'o') + sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_substitute_01', {}) + call term_sendkeys(buf, "\") + + " Select three lines at the cursor using previous pattern. + call term_sendkeys(buf, "/foo\") + sleep 100m + call term_sendkeys(buf, ':.,.+2s//') + sleep 100m + call VerifyScreenDump(buf, 'Test_incsearch_substitute_02', {}) + + " Deleting last slash should remove the match. + call term_sendkeys(buf, "\") + sleep 100m + call VerifyScreenDump(buf, 'Test_incsearch_substitute_03', {}) call term_sendkeys(buf, "\") call StopVimInTerminal(buf) -- cgit From 83f3218b286eb76e42c21dcd2ec7bec18683ead3 Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Tue, 11 Aug 2020 00:47:50 +0800 Subject: vim-patch:8.1.0278: 'incsearch' highlighting does not accept reverse range Problem: 'incsearch' highlighting does not accept reverse range. Solution: Swap the range when needed. (issue vim/vim#3321) https://github.com/vim/vim/commit/60d0871000e9abf3716ee035cba5b5a9d659e327 --- src/nvim/testdir/test_search.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index c2093f47fd..c2584f99b9 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -637,6 +637,12 @@ func Test_incsearch_substitute_dump() call term_sendkeys(buf, "\") sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_substitute_03', {}) + call term_sendkeys(buf, "\") + + " Reverse range is accepted + call term_sendkeys(buf, ':5,2s/foo') + sleep 100m + call VerifyScreenDump(buf, 'Test_incsearch_substitute_04', {}) call term_sendkeys(buf, "\") call StopVimInTerminal(buf) -- cgit From 8ae47ddf63bdc6e880eac2f5752da137507a34c0 Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Tue, 11 Aug 2020 00:49:12 +0800 Subject: vim-patch:8.1.0279: 'incsearch' highlighting does not skip white space Problem: 'incsearch' highlighting does not skip white space. Solution: Skip white space after the command. (issue vim/vim#3321) https://github.com/vim/vim/commit/2b926fcb3c5d8bd09a219009336bbec7c66ae67e --- src/nvim/testdir/test_search.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index c2584f99b9..0b403f8d2f 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -643,8 +643,14 @@ func Test_incsearch_substitute_dump() call term_sendkeys(buf, ':5,2s/foo') sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_substitute_04', {}) + call term_sendkeys(buf, "\") + " White space after the command is skipped + call term_sendkeys(buf, ':2,3sub /fo') + sleep 100m + call VerifyScreenDump(buf, 'Test_incsearch_substitute_05', {}) call term_sendkeys(buf, "\") + call StopVimInTerminal(buf) call delete('Xis_subst_script') endfunc -- cgit From 841ec4316c13179fc15ec6d74237377636f7090f Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Wed, 12 Aug 2020 03:09:45 +0800 Subject: vim-patch:8.1.0280: 'incsearch' highlighting does not work for ":g!/" Problem: 'incsearch' highlighting does not work for ":g!/". Solution: Skip the exclamation mark. (Hirohito Higashi) https://github.com/vim/vim/commit/def7b1dc6104a6ce6d7c3e3a615231178601b124 --- src/nvim/testdir/test_search.vim | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 0b403f8d2f..01e6f2d61c 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -408,6 +408,14 @@ func Test_search_cmdline3g() undo call feedkeys(":global/the\/d\", 'tx') call assert_equal(' 3 the theother', getline(2)) + undo + call feedkeys(":g!/the\/d\", 'tx') + call assert_equal(1, line('$')) + call assert_equal(' 2 the~e', getline(1)) + undo + call feedkeys(":global!/the\/d\", 'tx') + call assert_equal(1, line('$')) + call assert_equal(' 2 the~e', getline(1)) call Incsearch_cleanup() endfunc -- cgit From b24dabf266cb3c271f706450abb3d55d82981d38 Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Wed, 19 Aug 2020 00:06:17 +0800 Subject: vim-patch:8.1.0282: 'incsearch' does not work with command modifiers Problem: 'incsearch' does not work with command modifiers. Solution: Skip command modifiers. https://github.com/vim/vim/commit/33c4dbb74bdf41aadd193a704f597d4df20f0e47 --- src/nvim/testdir/test_search.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 01e6f2d61c..6708f30f4e 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -659,6 +659,12 @@ func Test_incsearch_substitute_dump() call VerifyScreenDump(buf, 'Test_incsearch_substitute_05', {}) call term_sendkeys(buf, "\") + " Command modifiers are skipped + call term_sendkeys(buf, ':above below browse botr confirm keepmar keepalt keeppat keepjum filter xxx hide lockm leftabove noau noswap rightbel sandbox silent silent! $tab top unsil vert verbose 4,5s/fo.') + sleep 100m + call VerifyScreenDump(buf, 'Test_incsearch_substitute_06', {}) + call term_sendkeys(buf, "\") + call StopVimInTerminal(buf) call delete('Xis_subst_script') endfunc -- cgit From 68f6abef1697d6879b76b515b1b2f67fa59dad1a Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Wed, 19 Aug 2020 00:48:03 +0800 Subject: vim-patch:8.1.0284: 'cursorline' highlighting wrong with 'incsearch' Problem: 'cursorline' highlighting wrong with 'incsearch'. Solution: Move the cursor back if the match is outside the range. https://github.com/vim/vim/commit/2f6a346a4cd2d5bdd6dc9b3209ebce7b6340221d --- src/nvim/testdir/test_search.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 6708f30f4e..5f421aad3c 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -614,6 +614,7 @@ func Test_incsearch_substitute_dump() \ 'for n in range(1, 10)', \ ' call setline(n, "foo " . n)', \ 'endfor', + \ 'call setline(11, "bar 11")', \ '3', \ ], 'Xis_subst_script') let buf = RunVimInTerminal('-S Xis_subst_script', {'rows': 9, 'cols': 70}) @@ -665,6 +666,20 @@ func Test_incsearch_substitute_dump() call VerifyScreenDump(buf, 'Test_incsearch_substitute_06', {}) call term_sendkeys(buf, "\") + " Cursorline highlighting at match + call term_sendkeys(buf, ":set cursorline\") + call term_sendkeys(buf, 'G9G') + call term_sendkeys(buf, ':9,11s/bar') + sleep 100m + call VerifyScreenDump(buf, 'Test_incsearch_substitute_07', {}) + call term_sendkeys(buf, "\") + + " Cursorline highlighting at cursor when no match + call term_sendkeys(buf, ':9,10s/bar') + sleep 100m + call VerifyScreenDump(buf, 'Test_incsearch_substitute_08', {}) + call term_sendkeys(buf, "\") + call StopVimInTerminal(buf) call delete('Xis_subst_script') endfunc -- cgit From c0102c140cb6d0e2be37c583d34f8ecdf7228f3a Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Wed, 19 Aug 2020 00:54:41 +0800 Subject: vim-patch:8.1.0286: 'incsearch' does not apply to :smagic and :snomagic Problem: 'incsearch' does not apply to :smagic and :snomagic. Solution: Add support. (Hirohito Higashi) https://github.com/vim/vim/commit/167ae42685dcd430800c51ac7339f7f0938a3e70 --- src/nvim/testdir/test_search.vim | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 5f421aad3c..9c7b654e06 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -392,6 +392,14 @@ func Test_search_cmdline3s() undo call feedkeys(":%substitute/the\/xxx\", 'tx') call assert_equal(' 2 xxxe', getline('.')) + undo + call feedkeys(":%smagic/the.e/xxx\", 'tx') + call assert_equal(' 2 xxx', getline('.')) + undo + call assert_fails(":%snomagic/the.e/xxx\", 'E486') + " + call feedkeys(":%snomagic/the\\.e/xxx\", 'tx') + call assert_equal(' 2 xxx', getline('.')) call Incsearch_cleanup() endfunc -- cgit From ab7e101540435b7de221ded309b34f2f000105f4 Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Wed, 19 Aug 2020 00:49:38 +0800 Subject: vim-patch:8.1.0291: 'incsearch' highlighting not used for :sort Problem: 'incsearch' highlighting not used for :sort. Solution: Handle pattern in :sort command. https://github.com/vim/vim/commit/81f56536b1bc324eb173924a8cf4d7dbbf4f3fdb --- src/nvim/testdir/test_search.vim | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 9c7b654e06..96315faf2d 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -692,6 +692,33 @@ func Test_incsearch_substitute_dump() call delete('Xis_subst_script') endfunc +" Similar to Test_incsearch_substitute_dump() for :sort +func Test_incsearch_ssort_dump() + if !exists('+incsearch') + return + endif + if !CanRunVimInTerminal() + throw 'Skipped: cannot make screendumps' + endif + call writefile([ + \ 'set incsearch hlsearch scrolloff=0', + \ 'call setline(1, ["another one 2", "that one 3", "the one 1"])', + \ ], 'Xis_sort_script') + let buf = RunVimInTerminal('-S Xis_sort_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, ':sort ni u /on') + sleep 100m + call VerifyScreenDump(buf, 'Test_incsearch_sort_01', {}) + call term_sendkeys(buf, "\") + + call StopVimInTerminal(buf) + call delete('Xis_sort_script') +endfunc + func Test_incsearch_with_change() if !has('timers') || !exists('+incsearch') || !CanRunVimInTerminal() throw 'Skipped: cannot make screendumps and/or timers feature and/or incsearch option missing' -- cgit From 77bb48e740b260acd884242d77dc3e306ff9795c Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Wed, 19 Aug 2020 00:49:51 +0800 Subject: vim-patch:8.1.0295: no 'incsearch' highlighting for :vimgrep and similar Problem: No 'incsearch' highlighting for :vimgrep and similar commands. Solution: Parse the :vimgrep command and similar ones to locate the search pattern. (Hirohito Higashi, closes vim/vim#3344) https://github.com/vim/vim/commit/264cf5cfaf40e704aea2578e70c15ed9a9d0161e --- src/nvim/testdir/test_search.vim | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 96315faf2d..ef25a3c14d 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -719,6 +719,53 @@ func Test_incsearch_ssort_dump() call delete('Xis_sort_script') endfunc +" Similar to Test_incsearch_substitute_dump() for :vimgrep famiry +func Test_incsearch_vimgrep_dump() + if !exists('+incsearch') + return + endif + if !CanRunVimInTerminal() + throw 'Skipped: cannot make screendumps' + endif + call writefile([ + \ 'set incsearch hlsearch scrolloff=0', + \ 'call setline(1, ["another one 2", "that one 3", "the one 1"])', + \ ], 'Xis_vimgrep_script') + let buf = RunVimInTerminal('-S Xis_vimgrep_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, ':vimgrep on') + sleep 100m + call VerifyScreenDump(buf, 'Test_incsearch_vimgrep_01', {}) + call term_sendkeys(buf, "\") + + call term_sendkeys(buf, ':vimg /on/ *.txt') + sleep 100m + call VerifyScreenDump(buf, 'Test_incsearch_vimgrep_02', {}) + call term_sendkeys(buf, "\") + + call term_sendkeys(buf, ':vimgrepadd "\") + + call term_sendkeys(buf, ':lv "tha') + sleep 100m + call VerifyScreenDump(buf, 'Test_incsearch_vimgrep_04', {}) + call term_sendkeys(buf, "\") + + call term_sendkeys(buf, ':lvimgrepa "the" **/*.txt') + sleep 100m + call VerifyScreenDump(buf, 'Test_incsearch_vimgrep_05', {}) + call term_sendkeys(buf, "\") + + call StopVimInTerminal(buf) + call delete('Xis_vimgrep_script') +endfunc + func Test_incsearch_with_change() if !has('timers') || !exists('+incsearch') || !CanRunVimInTerminal() throw 'Skipped: cannot make screendumps and/or timers feature and/or incsearch option missing' -- cgit From 4770a2bac52530dcfec64aa61cf29379a5ddec36 Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Wed, 19 Aug 2020 00:50:58 +0800 Subject: vim-patch:8.1.0320: too much 'incsearch' highlight for pat matching everything Problem: Too much 'incsearch' highlight for pattern matching everything. Solution: Add the skiplen to the command and remove the line range. (Christian Brabandt) Check for empty pattern earlier. https://github.com/vim/vim/commit/8b0d5ce881ac16a36ea00018ba13a58b0fdb7534 --- src/nvim/testdir/test_search.vim | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index ef25a3c14d..521ddeaddb 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -688,6 +688,14 @@ func Test_incsearch_substitute_dump() call VerifyScreenDump(buf, 'Test_incsearch_substitute_08', {}) call term_sendkeys(buf, "\") + " Only \v handled as empty pattern, does not move cursor + call term_sendkeys(buf, '3G4G') + call term_sendkeys(buf, ":nohlsearch\") + call term_sendkeys(buf, ':6,7s/\v') + sleep 100m + call VerifyScreenDump(buf, 'Test_incsearch_substitute_09', {}) + call term_sendkeys(buf, "\") + call StopVimInTerminal(buf) call delete('Xis_subst_script') endfunc -- cgit From f2743cfb6555ad0c917a59539a97f74737479ef1 Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Wed, 19 Aug 2020 00:51:08 +0800 Subject: vim-patch:8.1.0321: 'incsearch' regression: /\v highlights everything Problem: 'incsearch' regression: /\v highlights everything. Solution: Put back the empty_pattern() check. https://github.com/vim/vim/commit/4edfe2d2a2d70ea66a7f73e9b923c2d1f6246a57 --- src/nvim/testdir/test_search.vim | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 521ddeaddb..479311e934 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -701,7 +701,7 @@ func Test_incsearch_substitute_dump() endfunc " Similar to Test_incsearch_substitute_dump() for :sort -func Test_incsearch_ssort_dump() +func Test_incsearch_sort_dump() if !exists('+incsearch') return endif @@ -828,6 +828,41 @@ func Test_incsearch_scrolling() call delete('Xscript') endfunc +func Test_incsearch_search_dump() + if !exists('+incsearch') + return + endif + if !CanRunVimInTerminal() + return + endif + call writefile([ + \ 'set incsearch hlsearch scrolloff=0', + \ 'for n in range(1, 8)', + \ ' call setline(n, "foo " . n)', + \ 'endfor', + \ '3', + \ ], 'Xis_search_script') + let buf = RunVimInTerminal('-S Xis_search_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, '/fo') + sleep 100m + call VerifyScreenDump(buf, 'Test_incsearch_search_01', {}) + call term_sendkeys(buf, "\") + sleep 100m + + call term_sendkeys(buf, '/\v') + sleep 100m + call VerifyScreenDump(buf, 'Test_incsearch_search_02', {}) + call term_sendkeys(buf, "\") + + call StopVimInTerminal(buf) + call delete('Xis_search_script') +endfunc + func Test_incsearch_substitute() throw 'skipped: Nvim does not support test_override()' if !exists('+incsearch') -- cgit From b59c293c25dce6387c939d536c4d7b0f98d83d9e Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Wed, 19 Aug 2020 00:51:16 +0800 Subject: vim-patch:8.1.0339: wrong highlight when 'incsearch' set and cancelling :s Problem: Wrong highlight when 'incsearch' set and cancelling :s. Solution: Reset search line range. (Hirohito Higashi, Masamichi Abe) https://github.com/vim/vim/commit/f13daa46da85a80dd05704cdde0660c2b2651a5a --- src/nvim/testdir/test_search.vim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 479311e934..baa44da665 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -696,6 +696,15 @@ func Test_incsearch_substitute_dump() call VerifyScreenDump(buf, 'Test_incsearch_substitute_09', {}) call term_sendkeys(buf, "\") + call term_sendkeys(buf, ":set nocursorline\") + + " All matches are highlighted for 'hlsearch' after the incsearch canceled + call term_sendkeys(buf, "1G*") + call term_sendkeys(buf, ":2,5s/foo") + sleep 100m + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_incsearch_substitute_10', {}) + call StopVimInTerminal(buf) call delete('Xis_subst_script') endfunc -- cgit From e2dc2a6bd751f5614fb7f51a2bd1bc28c3bf4530 Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Wed, 19 Aug 2020 00:51:24 +0800 Subject: vim-patch:8.1.0351: 'incsearch' for :/foo/s// changes last search pattern Problem: 'incsearch' for :/foo/s// changes last search pattern. Solution: Save the last search pattern earlier. https://github.com/vim/vim/commit/198cb66d652d3d8ac16226dcc929a11b0b720151 --- src/nvim/testdir/test_search.vim | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index baa44da665..dd13baec66 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -783,6 +783,24 @@ func Test_incsearch_vimgrep_dump() call delete('Xis_vimgrep_script') endfunc +func Test_keep_last_search_pattern() + throw 'skipped: Nvim does not support test_override()' + if !exists('+incsearch') + return + endif + new + call setline(1, ['foo', 'foo', 'foo']) + set incsearch + call test_override("char_avail", 1) + let @/ = 'bar' + call feedkeys(":/foo/s//\", 'ntx') + call assert_equal('bar', @/) + + bwipe! + call test_override("ALL", 0) + set noincsearch +endfunc + func Test_incsearch_with_change() if !has('timers') || !exists('+incsearch') || !CanRunVimInTerminal() throw 'Skipped: cannot make screendumps and/or timers feature and/or incsearch option missing' -- cgit From b0042cafc072c92e0db07cecb6ff03a9fc1df78e Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Wed, 19 Aug 2020 00:51:38 +0800 Subject: vim-patch:8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W Problem: Using :s with 'incsearch' prevents CTRL-R CTRL-W. (Boris Staletic) Solution: When past the pattern put cursor back in the start position. (closes vim/vim#3413) https://github.com/vim/vim/commit/99f043a57d0be35ef72572b0429cf51525c3cd2b --- src/nvim/testdir/test_search.vim | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index dd13baec66..8741def3bf 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -801,6 +801,44 @@ func Test_keep_last_search_pattern() set noincsearch endfunc +func Test_word_under_cursor_after_match() + throw 'skipped: Nvim does not support test_override()' + if !exists('+incsearch') + return + endif + new + call setline(1, 'foo bar') + set incsearch + call test_override("char_avail", 1) + try + call feedkeys("/foo\\\", 'ntx') + catch /E486:/ + endtry + call assert_equal('foobar', @/) + + bwipe! + call test_override("ALL", 0) + set noincsearch +endfunc + +func Test_subst_word_under_cursor() + throw 'skipped: Nvim does not support test_override()' + if !exists('+incsearch') + return + endif + new + call setline(1, ['int SomeLongName;', 'for (xxx = 1; xxx < len; ++xxx)']) + set incsearch + call test_override("char_avail", 1) + call feedkeys("/LongName\", 'ntx') + call feedkeys(":%s/xxx/\\/g\", 'ntx') + call assert_equal('for (SomeLongName = 1; SomeLongName < len; ++SomeLongName)', getline(2)) + + bwipe! + call test_override("ALL", 0) + set noincsearch +endfunc + func Test_incsearch_with_change() if !has('timers') || !exists('+incsearch') || !CanRunVimInTerminal() throw 'Skipped: cannot make screendumps and/or timers feature and/or incsearch option missing' -- cgit From 112092fa1598fbfa9dae723da5e52d2dec8da2f0 Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Wed, 19 Aug 2020 00:54:50 +0800 Subject: vim-patch:8.1.0392: error while typing :/foo/s// with 'incsearch' enabled Problem: Error while typing :/foo/s// with 'incsearch' enabled. Solution: Do not give search errors when highlighting matches. https://github.com/vim/vim/commit/50eb16c3b23235b21ce4494673a7741a9a196176 --- src/nvim/testdir/test_search.vim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 8741def3bf..ec4c15cd11 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -796,6 +796,10 @@ func Test_keep_last_search_pattern() call feedkeys(":/foo/s//\", 'ntx') call assert_equal('bar', @/) + " no error message if pattern not found + call feedkeys(":/xyz/s//\", 'ntx') + call assert_equal('bar', @/) + bwipe! call test_override("ALL", 0) set noincsearch -- cgit From f7d2e37e36dafd3a45d343c771d2ff53f6a4b875 Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Wed, 19 Aug 2020 00:51:47 +0800 Subject: vim-patch:8.1.0399: 'hlsearch' highlight remains in other window Problem: 'hlsearch' highlight remains in other window after cancelling command. Solution: Redraw all windows. Also remove unnecessary delays. (closes vim/vim#3437) https://github.com/vim/vim/commit/65985ac998713dfe0f0ff1dd49c5e3e8f17f4870 --- src/nvim/testdir/test_search.vim | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index ec4c15cd11..767cf99be3 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -639,7 +639,6 @@ func Test_incsearch_substitute_dump() call term_sendkeys(buf, 'o') sleep 100m call term_sendkeys(buf, 'o') - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_substitute_01', {}) call term_sendkeys(buf, "\") @@ -647,30 +646,25 @@ func Test_incsearch_substitute_dump() call term_sendkeys(buf, "/foo\") sleep 100m call term_sendkeys(buf, ':.,.+2s//') - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_substitute_02', {}) " Deleting last slash should remove the match. call term_sendkeys(buf, "\") - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_substitute_03', {}) call term_sendkeys(buf, "\") " Reverse range is accepted call term_sendkeys(buf, ':5,2s/foo') - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_substitute_04', {}) call term_sendkeys(buf, "\") " White space after the command is skipped call term_sendkeys(buf, ':2,3sub /fo') - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_substitute_05', {}) call term_sendkeys(buf, "\") " Command modifiers are skipped call term_sendkeys(buf, ':above below browse botr confirm keepmar keepalt keeppat keepjum filter xxx hide lockm leftabove noau noswap rightbel sandbox silent silent! $tab top unsil vert verbose 4,5s/fo.') - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_substitute_06', {}) call term_sendkeys(buf, "\") @@ -678,13 +672,11 @@ func Test_incsearch_substitute_dump() call term_sendkeys(buf, ":set cursorline\") call term_sendkeys(buf, 'G9G') call term_sendkeys(buf, ':9,11s/bar') - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_substitute_07', {}) call term_sendkeys(buf, "\") " Cursorline highlighting at cursor when no match call term_sendkeys(buf, ':9,10s/bar') - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_substitute_08', {}) call term_sendkeys(buf, "\") @@ -692,7 +684,6 @@ func Test_incsearch_substitute_dump() call term_sendkeys(buf, '3G4G') call term_sendkeys(buf, ":nohlsearch\") call term_sendkeys(buf, ':6,7s/\v') - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_substitute_09', {}) call term_sendkeys(buf, "\") @@ -705,6 +696,15 @@ func Test_incsearch_substitute_dump() call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_incsearch_substitute_10', {}) + call term_sendkeys(buf, ":split\") + call term_sendkeys(buf, ":let @/ = 'xyz'\") + call term_sendkeys(buf, ":%s/.") + call VerifyScreenDump(buf, 'Test_incsearch_substitute_11', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_incsearch_substitute_12', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_incsearch_substitute_13', {}) + call StopVimInTerminal(buf) call delete('Xis_subst_script') endfunc @@ -728,7 +728,6 @@ func Test_incsearch_sort_dump() " Need to send one key at a time to force a redraw. call term_sendkeys(buf, ':sort ni u /on') - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_sort_01', {}) call term_sendkeys(buf, "\") @@ -755,27 +754,22 @@ func Test_incsearch_vimgrep_dump() " Need to send one key at a time to force a redraw. call term_sendkeys(buf, ':vimgrep on') - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_vimgrep_01', {}) call term_sendkeys(buf, "\") call term_sendkeys(buf, ':vimg /on/ *.txt') - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_vimgrep_02', {}) call term_sendkeys(buf, "\") call term_sendkeys(buf, ':vimgrepadd "\") call term_sendkeys(buf, ':lv "tha') - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_vimgrep_04', {}) call term_sendkeys(buf, "\") call term_sendkeys(buf, ':lvimgrepa "the" **/*.txt') - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_vimgrep_05', {}) call term_sendkeys(buf, "\") @@ -918,13 +912,11 @@ func Test_incsearch_search_dump() " Need to send one key at a time to force a redraw. call term_sendkeys(buf, '/fo') - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_search_01', {}) call term_sendkeys(buf, "\") sleep 100m call term_sendkeys(buf, '/\v') - sleep 100m call VerifyScreenDump(buf, 'Test_incsearch_search_02', {}) call term_sendkeys(buf, "\") -- cgit