0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

updated for version 7.3.871

Problem:    search('^$', 'c') does not use the empty match under the cursor.
Solution:   Special handling of the 'c' flag. (Christian Brabandt)
            Add tests.
This commit is contained in:
Bram Moolenaar 2013-03-19 15:27:48 +01:00
parent af62ff3696
commit db333a5b8d
4 changed files with 24 additions and 0 deletions

View File

@ -727,6 +727,8 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm)
++matchcol; ++matchcol;
} }
} }
if (options & SEARCH_START)
break;
if (ptr[matchcol] == NUL if (ptr[matchcol] == NUL
|| (nmatched = vim_regexec_multi(&regmatch, || (nmatched = vim_regexec_multi(&regmatch,
win, buf, lnum + matchpos.lnum, win, buf, lnum + matchpos.lnum,

View File

@ -2,6 +2,7 @@ Tests for "vaBiB", end could be wrong.
Also test ":s/pat/sub/" with different ~s in sub. Also test ":s/pat/sub/" with different ~s in sub.
Also test for ^Vxff and ^Vo123 in Insert mode. Also test for ^Vxff and ^Vo123 in Insert mode.
Also test "[m", "]m", "[M" and "]M" Also test "[m", "]m", "[M" and "]M"
Also test search()
STARTTEST STARTTEST
:so small.vim :so small.vim
@ -34,6 +35,16 @@ j2]MaH:.w >>test.out
2[MaJ:.w >>test.out 2[MaJ:.w >>test.out
k[MaK:.w >>test.out k[MaK:.w >>test.out
3[MaL:.w >>test.out 3[MaL:.w >>test.out
:"
/^foobar
:let startline = line('.')
:call search('foobar', 'c')
:call append(line('$'), line('.') - startline)
j:call search('^$', 'c')
:call append(line('$'), line('.') - startline)
:call search('^$', 'bc')
:call append(line('$'), line('.') - startline)
:/^search()/,$w >>test.out
:qa! :qa!
ENDTEST ENDTEST
@ -64,3 +75,8 @@ Piece of Java
} }
} e3 } e3
} }
foobar
search()

View File

@ -15,3 +15,7 @@ ABC !ag8
}JH e3 }JH e3
}K e2 }K e2
{LF {LF
search()
0
1
1

View File

@ -728,6 +728,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
871,
/**/ /**/
870, 870,
/**/ /**/