Skip to content

Commit 04e786a

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents bdaf4c0 + da5116d commit 04e786a

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

src/ex_getln.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,6 +1716,14 @@ getcmdline(
17161716
search_start = t;
17171717
(void)decl(&search_start);
17181718
}
1719+
else if (c == Ctrl_G && firstc == '?')
1720+
{
1721+
/* move just after the current match, so that
1722+
* when nv_search finishes the cursor will be
1723+
* put back on the match */
1724+
search_start = t;
1725+
(void)incl(&search_start);
1726+
}
17191727
if (LT_POS(t, search_start) && c == Ctrl_G)
17201728
{
17211729
/* wrap around */

src/testdir/test_search.vim

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,37 @@ func Test_search_cmdline3()
322322
call test_override("char_avail", 0)
323323
bw!
324324
endfunc
325+
326+
func Test_search_cmdline4()
327+
if !exists('+incsearch')
328+
return
329+
endif
330+
" need to disable char_avail,
331+
" so that expansion of commandline works
332+
call test_override("char_avail", 1)
333+
new
334+
call setline(1, [' 1 the first', ' 2 the second', ' 3 the third'])
335+
set incsearch
336+
$
337+
call feedkeys("?the\<c-g>\<cr>", 'tx')
338+
call assert_equal(' 3 the third', getline('.'))
339+
$
340+
call feedkeys("?the\<c-g>\<c-g>\<cr>", 'tx')
341+
call assert_equal(' 1 the first', getline('.'))
342+
$
343+
call feedkeys("?the\<c-g>\<c-g>\<c-g>\<cr>", 'tx')
344+
call assert_equal(' 2 the second', getline('.'))
345+
$
346+
call feedkeys("?the\<c-t>\<cr>", 'tx')
347+
call assert_equal(' 1 the first', getline('.'))
348+
$
349+
call feedkeys("?the\<c-t>\<c-t>\<cr>", 'tx')
350+
call assert_equal(' 3 the third', getline('.'))
351+
$
352+
call feedkeys("?the\<c-t>\<c-t>\<c-t>\<cr>", 'tx')
353+
call assert_equal(' 2 the second', getline('.'))
354+
" clean up
355+
set noincsearch
356+
call test_override("char_avail", 0)
357+
bw!
358+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,8 @@ static char *(features[]) =
779779

780780
static int included_patches[] =
781781
{ /* Add new patch number below this line */
782+
/**/
783+
692,
782784
/**/
783785
691,
784786
/**/

0 commit comments

Comments
 (0)