From 7bcb30e91387800261c0154c2d53b6118100dca0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 3 Apr 2013 21:14:29 +0200 Subject: [PATCH] updated for version 7.3.877 Problem: Forward searching with search() is broken. Solution: Fix it and add tests. (Sung Pae) --- src/search.c | 4 ++-- src/testdir/test14.in | 4 ++++ src/testdir/test14.ok | 1 + src/version.c | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/search.c b/src/search.c index 934e4b0cff..f9a5b84c03 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(®match, @@ -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 b6f2f57605..ebcb58c9d0 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 fb795a81ce..1fd89165e1 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 a68eb13d54..ce12628ad1 100644 --- a/src/version.c +++ b/src/version.c @@ -728,6 +728,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 877, /**/ 876, /**/