Mercurial > vim
changeset 4252:96f478b812b1 v7.3.877
updated for version 7.3.877
Problem: Forward searching with search() is broken.
Solution: Fix it and add tests. (Sung Pae)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 03 Apr 2013 21:14:29 +0200 |
parents | 0c618ae9b040 |
children | ccbde540a714 |
files | src/search.c src/testdir/test14.in src/testdir/test14.ok src/version.c |
diffstat | 4 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/search.c +++ b/src/search.c @@ -727,7 +727,7 @@ searchit(win, buf, pos, dir, pat, count, ++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, /* 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)) {
--- 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()