summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-07-16 21:38:51 +0200
committerBram Moolenaar <Bram@vim.org>2019-07-16 21:38:51 +0200
commit69a5b867940d25f68a782de5c1165d65b51fcafa (patch)
tree7f76d65e19c2ec563004c7ccc01750dec55fc681
parent61386408063a2300d7d7f42c5156f66f6252fb54 (diff)
downloadvim-git-69a5b867940d25f68a782de5c1165d65b51fcafa.tar.gz
patch 8.1.1704: C-R C-W does not work after C-G when using 'incsearch'v8.1.1704
Problem: C-R C-W does not work after C-G when using 'incsearch'. Solution: Put cursor at end of the match. (Yasuhiro Matsumoto, closes #4664)
-rw-r--r--src/ex_getln.c1
-rw-r--r--src/testdir/test_search.vim10
-rw-r--r--src/version.c2
3 files changed, 10 insertions, 3 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index b1b996183..efeae94ed 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -713,6 +713,7 @@ may_adjust_incsearch_highlighting(
save_viewstate(&is_state->old_viewstate);
update_screen(NOT_VALID);
redrawcmdline();
+ curwin->w_cursor = is_state->match_end;
}
else
vim_beep(BO_ERROR);
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index 2765c8cbf..a356393b0 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -240,6 +240,10 @@ func Test_search_cmdline2()
" go to previous match (on line 2)
call feedkeys("/the\<C-G>\<C-G>\<C-G>\<C-T>\<C-T>\<C-T>\<cr>", 'tx')
call assert_equal(' 2 these', getline('.'))
+ 1
+ " go to previous match (on line 2)
+ call feedkeys("/the\<C-G>\<C-R>\<C-W>\<cr>", 'tx')
+ call assert_equal('theother', @/)
" Test 2: keep the view,
" after deleting a character from the search cmd
@@ -251,7 +255,7 @@ func Test_search_cmdline2()
call assert_equal({'lnum': 10, 'leftcol': 0, 'col': 4, 'topfill': 0, 'topline': 6, 'coladd': 0, 'skipcol': 0, 'curswant': 4}, winsaveview())
" remove all history entries
- for i in range(10)
+ for i in range(11)
call histdel('/')
endfor
@@ -477,14 +481,14 @@ func Test_search_cmdline5()
" Do not call test_override("char_avail", 1) so that <C-g> and <C-t> work
" regardless char_avail.
new
- call setline(1, [' 1 the first', ' 2 the second', ' 3 the third'])
+ call setline(1, [' 1 the first', ' 2 the second', ' 3 the third', ''])
set incsearch
1
call feedkeys("/the\<c-g>\<c-g>\<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('.'))
+ call assert_equal(' 1 the first', getline('.'))
" clean up
set noincsearch
bw!
diff --git a/src/version.c b/src/version.c
index e3373bed5..aacfeb6b8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -778,6 +778,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1704,
+/**/
1703,
/**/
1702,