summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-04-03 21:14:29 +0200
committerBram Moolenaar <Bram@vim.org>2013-04-03 21:14:29 +0200
commit7bcb30e91387800261c0154c2d53b6118100dca0 (patch)
tree6b7d1b6c0cb7003626e7b7fe0af3a7b33e022091
parentcdffbeae2b031160a479f24cfedacab926938e5d (diff)
downloadvim-git-7bcb30e91387800261c0154c2d53b6118100dca0.tar.gz
updated for version 7.3.877v7.3.877
Problem: Forward searching with search() is broken. Solution: Fix it and add tests. (Sung Pae)
-rw-r--r--src/search.c4
-rw-r--r--src/testdir/test14.in4
-rw-r--r--src/testdir/test14.ok1
-rw-r--r--src/version.c2
4 files changed, 9 insertions, 2 deletions
diff --git a/src/search.c b/src/search.c
index 934e4b0cf..f9a5b84c0 100644
--- a/src/search.c
+++ b/src/search.c
@@ -727,7 +727,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm)
++matchcol;
}
}
- if (options & SEARCH_START)
+ if (matchcol == 0 && (options & SEARCH_START))
break;
if (ptr[matchcol] == NUL
|| (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
* 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 b6f2f5760..ebcb58c9d 100644
--- a/src/testdir/test14.in
+++ b/src/testdir/test14.in
@@ -44,6 +44,9 @@ j:call search('^$', 'c')
: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 @@ Piece of Java
foobar
+one two
search()
diff --git a/src/testdir/test14.ok b/src/testdir/test14.ok
index fb795a81c..1fd89165e 100644
--- a/src/testdir/test14.ok
+++ b/src/testdir/test14.ok
@@ -19,3 +19,4 @@ search()
0
1
1
+two
diff --git a/src/version.c b/src/version.c
index a68eb13d5..ce12628ad 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 877,
+/**/
876,
/**/
875,