diff src/testdir/test_search.vim @ 11619:80af4916eadc v8.0.0692

patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction commit https://github.com/vim/vim/commit/da5116da4586fc714434411d2cccb066caa3723e Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 1 23:11:17 2017 +0200 patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction Problem: Using CTRL-G with 'incsearch' and ? goes in the wrong direction. (Ramel Eshed) Solution: Adjust search_start. (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Sat, 01 Jul 2017 23:15:03 +0200
parents 7428a08c2f68
children 44aa2997239d
line wrap: on
line diff
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -322,3 +322,37 @@ func Test_search_cmdline3()
   call test_override("char_avail", 0)
   bw!
 endfunc
+
+func Test_search_cmdline4()
+  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 the first', '  2 the second', '  3 the third'])
+  set incsearch
+  $
+  call feedkeys("?the\<c-g>\<cr>", 'tx')
+  call assert_equal('  3 the third', getline('.'))
+  $
+  call feedkeys("?the\<c-g>\<c-g>\<cr>", 'tx')
+  call assert_equal('  1 the first', getline('.'))
+  $
+  call feedkeys("?the\<c-g>\<c-g>\<c-g>\<cr>", 'tx')
+  call assert_equal('  2 the second', getline('.'))
+  $
+  call feedkeys("?the\<c-t>\<cr>", 'tx')
+  call assert_equal('  1 the first', getline('.'))
+  $
+  call feedkeys("?the\<c-t>\<c-t>\<cr>", 'tx')
+  call assert_equal('  3 the third', getline('.'))
+  $
+  call feedkeys("?the\<c-t>\<c-t>\<c-t>\<cr>", 'tx')
+  call assert_equal('  2 the second', getline('.'))
+  " clean up
+  set noincsearch
+  call test_override("char_avail", 0)
+  bw!
+endfunc