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