Mercurial > vim
comparison src/eval.c @ 266:e7904492cb75 v7.0071
updated for version 7.0071
author | vimboss |
---|---|
date | Sun, 24 Apr 2005 22:09:56 +0000 |
parents | c50c82c5e230 |
children | 8d34af900bae |
comparison
equal
deleted
inserted
replaced
265:8e2cc4452728 | 266:e7904492cb75 |
---|---|
12059 char_u *spat, *mpat, *epat; | 12059 char_u *spat, *mpat, *epat; |
12060 char_u *skip; | 12060 char_u *skip; |
12061 char_u *pat, *pat2, *pat3; | 12061 char_u *pat, *pat2, *pat3; |
12062 pos_T pos; | 12062 pos_T pos; |
12063 pos_T firstpos; | 12063 pos_T firstpos; |
12064 pos_T foundpos; | |
12064 pos_T save_cursor; | 12065 pos_T save_cursor; |
12065 pos_T save_pos; | 12066 pos_T save_pos; |
12066 int save_p_ws = p_ws; | 12067 int save_p_ws = p_ws; |
12067 char_u *save_cpo; | 12068 char_u *save_cpo; |
12068 int dir; | 12069 int dir; |
12112 skip = get_tv_string_buf(&argvars[4], nbuf3); | 12113 skip = get_tv_string_buf(&argvars[4], nbuf3); |
12113 | 12114 |
12114 save_cursor = curwin->w_cursor; | 12115 save_cursor = curwin->w_cursor; |
12115 pos = curwin->w_cursor; | 12116 pos = curwin->w_cursor; |
12116 firstpos.lnum = 0; | 12117 firstpos.lnum = 0; |
12118 foundpos.lnum = 0; | |
12117 pat = pat3; | 12119 pat = pat3; |
12118 for (;;) | 12120 for (;;) |
12119 { | 12121 { |
12120 n = searchit(curwin, curbuf, &pos, dir, pat, 1L, | 12122 n = searchit(curwin, curbuf, &pos, dir, pat, 1L, |
12121 SEARCH_KEEP, RE_SEARCH); | 12123 SEARCH_KEEP, RE_SEARCH); |
12123 /* didn't find it or found the first match again: FAIL */ | 12125 /* didn't find it or found the first match again: FAIL */ |
12124 break; | 12126 break; |
12125 | 12127 |
12126 if (firstpos.lnum == 0) | 12128 if (firstpos.lnum == 0) |
12127 firstpos = pos; | 12129 firstpos = pos; |
12130 if (equalpos(pos, foundpos)) | |
12131 { | |
12132 /* Found the same position again. Can happen with a pattern that | |
12133 * has "\zs" at the end and searching backwards. Advance one | |
12134 * character and try again. */ | |
12135 if (dir == BACKWARD) | |
12136 decl(&pos); | |
12137 else | |
12138 incl(&pos); | |
12139 } | |
12140 foundpos = pos; | |
12128 | 12141 |
12129 /* If the skip pattern matches, ignore this match. */ | 12142 /* If the skip pattern matches, ignore this match. */ |
12130 if (*skip != NUL) | 12143 if (*skip != NUL) |
12131 { | 12144 { |
12132 save_pos = curwin->w_cursor; | 12145 save_pos = curwin->w_cursor; |