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)
diff --git a/src/search.c b/src/search.c
index 1c971ff..fc820b9 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1161,12 +1161,20 @@
{
if (spats[RE_SEARCH].pat == NULL) /* no previous pattern */
{
- EMSG(_(e_noprevre));
- retval = 0;
- goto end_do_search;
+ pat = spats[RE_SUBST].pat;
+ if (pat == NULL)
+ {
+ EMSG(_(e_noprevre));
+ retval = 0;
+ goto end_do_search;
+ }
+ searchstr = pat;
}
- /* make search_regcomp() use spats[RE_SEARCH].pat */
- searchstr = (char_u *)"";
+ else
+ {
+ /* make search_regcomp() use spats[RE_SEARCH].pat */
+ searchstr = (char_u *)"";
+ }
}
if (pat != NULL && *pat != NUL) /* look for (new) offset */
@@ -4527,7 +4535,7 @@
#if defined(FEAT_FIND_ID) || defined(PROTO)
/*
* Find identifiers or defines in included files.
- * if p_ic && (compl_cont_status & CONT_SOL) then ptr must be in lowercase.
+ * If p_ic && (compl_cont_status & CONT_SOL) then ptr must be in lowercase.
*/
void
find_pattern_in_path(ptr, dir, len, whole, skip_comments,