updated for version 7.3.877
Problem: Forward searching with search() is broken.
Solution: Fix it and add tests. (Sung Pae)
diff --git a/src/search.c b/src/search.c
index 934e4b0..f9a5b84 100644
--- a/src/search.c
+++ b/src/search.c
@@ -727,7 +727,7 @@
++matchcol;
}
}
- if (options & SEARCH_START)
+ if (matchcol == 0 && (options & SEARCH_START))
break;
if (ptr[matchcol] == NUL
|| (nmatched = vim_regexec_multi(®match,
@@ -869,7 +869,7 @@
/* With the SEARCH_END option move to the last character
* of the match. Don't do it for an empty match, end
* 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.col == endpos.col))
{
diff --git a/src/testdir/test14.in b/src/testdir/test14.in
index b6f2f57..ebcb58c 100644
--- a/src/testdir/test14.in
+++ b/src/testdir/test14.in
@@ -44,6 +44,9 @@
:call append(line('$'), line('.') - startline)
:call search('^$', 'bc')
:call append(line('$'), line('.') - startline)
+/two
+:call search('.', 'c')
+:call append(line('$'), getline('.')[col('.') - 1:])
:/^search()/,$w >>test.out
:qa!
ENDTEST
@@ -79,4 +82,5 @@
foobar
+one two
search()
diff --git a/src/testdir/test14.ok b/src/testdir/test14.ok
index fb795a8..1fd8916 100644
--- a/src/testdir/test14.ok
+++ b/src/testdir/test14.ok
@@ -19,3 +19,4 @@
0
1
1
+two
diff --git a/src/version.c b/src/version.c
index a68eb13..ce12628 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 877,
+/**/
876,
/**/
875,