On Sat, Mar 23, 2013 at 03:00:48PM +0100, Bram Moolenaar wrote:

> Thanks!
>
> Apparently the tests didn't catch this mistake.  Would be nice to have a
> test for this.

Great! Attached is the previous patch plus a test:

    one two

Cursor is at letter `t`, search forward with `c`, then write current
line from current column to EOL. Failing test writes `one two`, passing
test writes `two`.

Thank you.

    Sung Pae
diff --git a/src/search.c b/src/search.c
index 934e4b0..c8dd6da 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,
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 @@ 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 fb795a8..1fd8916 100644
--- a/src/testdir/test14.ok
+++ b/src/testdir/test14.ok
@@ -19,3 +19,4 @@ search()
 0
 1
 1
+two

Attachment: pgpGT2xgkcoTN.pgp
Description: PGP signature

Raspunde prin e-mail lui