diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-04-24 22:09:56 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-04-24 22:09:56 +0000 |
commit | c9a2d2e2403663946ea804a00ffa3699d1d8b927 (patch) | |
tree | 7e957d1433d449b17fa92aab68c3dfdb2df9252b /src | |
parent | dba8a917baf8954c8d93edb677a41d7370125d50 (diff) | |
download | vim-c9a2d2e2403663946ea804a00ffa3699d1d8b927.zip |
updated for version 7.0071
Diffstat (limited to 'src')
-rw-r--r-- | src/eval.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c index edcb2fa44..b33412e9d 100644 --- a/src/eval.c +++ b/src/eval.c @@ -12061,6 +12061,7 @@ f_searchpair(argvars, rettv) char_u *pat, *pat2, *pat3; pos_T pos; pos_T firstpos; + pos_T foundpos; pos_T save_cursor; pos_T save_pos; int save_p_ws = p_ws; @@ -12114,6 +12115,7 @@ f_searchpair(argvars, rettv) save_cursor = curwin->w_cursor; pos = curwin->w_cursor; firstpos.lnum = 0; + foundpos.lnum = 0; pat = pat3; for (;;) { @@ -12125,6 +12127,17 @@ f_searchpair(argvars, rettv) if (firstpos.lnum == 0) firstpos = pos; + if (equalpos(pos, foundpos)) + { + /* Found the same position again. Can happen with a pattern that + * has "\zs" at the end and searching backwards. Advance one + * character and try again. */ + if (dir == BACKWARD) + decl(&pos); + else + incl(&pos); + } + foundpos = pos; /* If the skip pattern matches, ignore this match. */ if (*skip != NUL) |