updated for version 7.3.877

Problem:    Forward searching with search() is broken.
Solution:   Fix it and add tests. (Sung Pae)
This commit is contained in:
Bram Moolenaar
2013-04-03 21:14:29 +02:00
parent cdffbeae2b
commit 7bcb30e913
4 changed files with 9 additions and 2 deletions

View File

@ -727,7 +727,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm)
++matchcol; ++matchcol;
} }
} }
if (options & SEARCH_START) if (matchcol == 0 && (options & SEARCH_START))
break; break;
if (ptr[matchcol] == NUL if (ptr[matchcol] == NUL
|| (nmatched = vim_regexec_multi(&regmatch, || (nmatched = vim_regexec_multi(&regmatch,
@ -869,7 +869,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm)
/* With the SEARCH_END option move to the last character /* With the SEARCH_END option move to the last character
* of the match. Don't do it for an empty match, end * of the match. Don't do it for an empty match, end
* should be same as start then. */ * should be same as start then. */
if (options & SEARCH_END && !(options & SEARCH_NOOF) if ((options & SEARCH_END) && !(options & SEARCH_NOOF)
&& !(matchpos.lnum == endpos.lnum && !(matchpos.lnum == endpos.lnum
&& matchpos.col == endpos.col)) && matchpos.col == endpos.col))
{ {

View File

@ -44,6 +44,9 @@ j:call search('^$', 'c')
:call append(line('$'), line('.') - startline) :call append(line('$'), line('.') - startline)
:call search('^$', 'bc') :call search('^$', 'bc')
:call append(line('$'), line('.') - startline) :call append(line('$'), line('.') - startline)
/two
:call search('.', 'c')
:call append(line('$'), getline('.')[col('.') - 1:])
:/^search()/,$w >>test.out :/^search()/,$w >>test.out
:qa! :qa!
ENDTEST ENDTEST
@ -79,4 +82,5 @@ Piece of Java
foobar foobar
one two
search() search()

View File

@ -19,3 +19,4 @@ search()
0 0
1 1
1 1
two

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 */
/**/
877,
/**/ /**/
876, 876,
/**/ /**/