comparison src/search.c @ 2719:0139403c8eb0 v7.3.135

updated for version 7.3.135 Problem: When there is no previous substitute pattern, the previous search pattern is used. The other way around doesn't work. Solution: When there is no previous search pattern, use the previous substitute pattern if possible. (Christian Brabandt)
author Bram Moolenaar <bram@vim.org>
date Fri, 25 Feb 2011 18:38:36 +0100
parents 7c2e6ba1d702
children 8bd38abda314
comparison
equal deleted inserted replaced
2718:31757405c0c5 2719:0139403c8eb0
1159 /* use previous pattern */ 1159 /* use previous pattern */
1160 if (pat == NULL || *pat == NUL || *pat == dirc) 1160 if (pat == NULL || *pat == NUL || *pat == dirc)
1161 { 1161 {
1162 if (spats[RE_SEARCH].pat == NULL) /* no previous pattern */ 1162 if (spats[RE_SEARCH].pat == NULL) /* no previous pattern */
1163 { 1163 {
1164 EMSG(_(e_noprevre)); 1164 pat = spats[RE_SUBST].pat;
1165 retval = 0; 1165 if (pat == NULL)
1166 goto end_do_search; 1166 {
1167 } 1167 EMSG(_(e_noprevre));
1168 /* make search_regcomp() use spats[RE_SEARCH].pat */ 1168 retval = 0;
1169 searchstr = (char_u *)""; 1169 goto end_do_search;
1170 }
1171 searchstr = pat;
1172 }
1173 else
1174 {
1175 /* make search_regcomp() use spats[RE_SEARCH].pat */
1176 searchstr = (char_u *)"";
1177 }
1170 } 1178 }
1171 1179
1172 if (pat != NULL && *pat != NUL) /* look for (new) offset */ 1180 if (pat != NULL && *pat != NUL) /* look for (new) offset */
1173 { 1181 {
1174 /* 1182 /*
4525 #endif 4533 #endif
4526 4534
4527 #if defined(FEAT_FIND_ID) || defined(PROTO) 4535 #if defined(FEAT_FIND_ID) || defined(PROTO)
4528 /* 4536 /*
4529 * Find identifiers or defines in included files. 4537 * Find identifiers or defines in included files.
4530 * if p_ic && (compl_cont_status & CONT_SOL) then ptr must be in lowercase. 4538 * If p_ic && (compl_cont_status & CONT_SOL) then ptr must be in lowercase.
4531 */ 4539 */
4532 void 4540 void
4533 find_pattern_in_path(ptr, dir, len, whole, skip_comments, 4541 find_pattern_in_path(ptr, dir, len, whole, skip_comments,
4534 type, count, action, start_lnum, end_lnum) 4542 type, count, action, start_lnum, end_lnum)
4535 char_u *ptr; /* pointer to search pattern */ 4543 char_u *ptr; /* pointer to search pattern */