summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-03-19 15:27:48 +0100
committerBram Moolenaar <Bram@vim.org>2013-03-19 15:27:48 +0100
commitdb333a5b8d0c72b7342d6d65ad2895a19a1c29d2 (patch)
treeba5d5768d952510d3f3e10f6a258e409e33d974e
parentaf62ff3696514a4f1b595629bcfa584748bc29ce (diff)
downloadvim-git-db333a5b8d0c72b7342d6d65ad2895a19a1c29d2.tar.gz
updated for version 7.3.871v7.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.
-rw-r--r--src/search.c2
-rw-r--r--src/testdir/test14.in16
-rw-r--r--src/testdir/test14.ok4
-rw-r--r--src/version.c2
4 files changed, 24 insertions, 0 deletions
diff --git a/src/search.c b/src/search.c
index fc7468046..934e4b0cf 100644
--- a/src/search.c
+++ b/src/search.c
@@ -727,6 +727,8 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm)
++matchcol;
}
}
+ if (options & SEARCH_START)
+ break;
if (ptr[matchcol] == NUL
|| (nmatched = vim_regexec_multi(&regmatch,
win, buf, lnum + matchpos.lnum,
diff --git a/src/testdir/test14.in b/src/testdir/test14.in
index 05c80257b..b6f2f5760 100644
--- a/src/testdir/test14.in
+++ b/src/testdir/test14.in
@@ -2,6 +2,7 @@ Tests for "vaBiB", end could be wrong.
Also test ":s/pat/sub/" with different ~s in sub.
Also test for ^Vxff and ^Vo123 in Insert mode.
Also test "[m", "]m", "[M" and "]M"
+Also test search()
STARTTEST
:so small.vim
@@ -34,6 +35,16 @@ j2]MaH:.w >>test.out
2[MaJ:.w >>test.out
k[MaK:.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!
ENDTEST
@@ -64,3 +75,8 @@ Piece of Java
}
} e3
}
+
+foobar
+
+
+search()
diff --git a/src/testdir/test14.ok b/src/testdir/test14.ok
index e893ba803..fb795a81c 100644
--- a/src/testdir/test14.ok
+++ b/src/testdir/test14.ok
@@ -15,3 +15,7 @@ ABC !ag8
}JH e3
}K e2
{LF
+search()
+0
+1
+1
diff --git a/src/version.c b/src/version.c
index 7705a21f3..1a652acdf 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 */
/**/
+ 871,
+/**/
870,
/**/
869,