diff src/testdir/test_search.vim @ 14687:2982a54aa304 v8.1.0356

patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W commit https://github.com/vim/vim/commit/99f043a57d0be35ef72572b0429cf51525c3cd2b Author: Bram Moolenaar <Bram@vim.org> Date: Sun Sep 9 15:54:14 2018 +0200 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 #3413)
author Christian Brabandt <cb@256bit.org>
date Sun, 09 Sep 2018 16:00:07 +0200
parents 7771a1ff8b99
children fd69edd2c67e
line wrap: on
line diff
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -1060,6 +1060,42 @@ func Test_keep_last_search_pattern()
   set noincsearch
 endfunc
 
+func Test_word_under_cursor_after_match()
+  if !exists('+incsearch')
+    return
+  endif
+  new
+  call setline(1, 'foo bar')
+  set incsearch
+  call test_override("char_avail", 1)
+  try
+    call feedkeys("/foo\<C-R>\<C-W>\<CR>", 'ntx')
+  catch /E486:/
+  endtry
+  call assert_equal('foobar', @/)
+
+  bwipe!
+  call test_override("ALL", 0)
+  set noincsearch
+endfunc
+
+func Test_subst_word_under_cursor()
+  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\<CR>", 'ntx')
+  call feedkeys(":%s/xxx/\<C-R>\<C-W>/g\<CR>", 'ntx')
+  call assert_equal('for (SomeLongName = 1; SomeLongName < len; ++SomeLongName)', getline(2))
+
+  bwipe!
+  call test_override("ALL", 0)
+  set noincsearch
+endfunc
+
 func Test_search_undefined_behaviour()
   if !has("terminal")
     return