summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-09-29 18:26:07 +0000
committerBram Moolenaar <Bram@vim.org>2005-09-29 18:26:07 +0000
commit482aaeb058a3c05235148d22f6c511416da009fb (patch)
treeb9c63e97ec2826bfeea041afe176a04763dbcfa8 /src/search.c
parent4463f296d0744915fa25dbd893821833043f9a25 (diff)
downloadvim-git-482aaeb058a3c05235148d22f6c511416da009fb.tar.gz
updated for version 7.0151v7.0151
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/search.c b/src/search.c
index 2ed15df2b..f4e8f611e 100644
--- a/src/search.c
+++ b/src/search.c
@@ -4410,6 +4410,7 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments,
int i;
char_u *already = NULL;
char_u *startp = NULL;
+ char_u *inc_opt = NULL;
#ifdef RISCOS
int previous_munging = __riscosify_control;
#endif
@@ -4449,10 +4450,10 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments,
if (regmatch.regprog == NULL)
goto fpip_end;
}
- if (*curbuf->b_p_inc != NUL || *p_inc != NUL)
+ inc_opt = (*curbuf->b_p_inc == NUL) ? p_inc : curbuf->b_p_inc;
+ if (*inc_opt != NUL)
{
- incl_regmatch.regprog = vim_regcomp(*curbuf->b_p_inc == NUL
- ? p_inc : curbuf->b_p_inc, p_magic ? RE_MAGIC : 0);
+ incl_regmatch.regprog = vim_regcomp(inc_opt, p_magic ? RE_MAGIC : 0);
if (incl_regmatch.regprog == NULL)
goto fpip_end;
incl_regmatch.rm_ic = FALSE; /* don't ignore case in incl. pat. */
@@ -4484,10 +4485,18 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments,
if (incl_regmatch.regprog != NULL
&& vim_regexec(&incl_regmatch, line, (colnr_T)0))
{
- new_fname = file_name_in_line(incl_regmatch.endp[0],
- 0, FNAME_EXP|FNAME_INCL|FNAME_REL, 1L,
- curr_fname == curbuf->b_fname
- ? curbuf->b_ffname : curr_fname);
+ char_u *p_fname = (curr_fname == curbuf->b_fname)
+ ? curbuf->b_ffname : curr_fname;
+
+ if (inc_opt != NULL && strstr((char *)inc_opt, "\\zs") != NULL)
+ /* Use text from '\zs' to '\ze' (or end) of 'include'. */
+ new_fname = find_file_name_in_path(incl_regmatch.startp[0],
+ incl_regmatch.endp[0] - incl_regmatch.startp[0],
+ FNAME_EXP|FNAME_INCL|FNAME_REL, 1L, p_fname);
+ else
+ /* Use text after match with 'include'. */
+ new_fname = file_name_in_line(incl_regmatch.endp[0], 0,
+ FNAME_EXP|FNAME_INCL|FNAME_REL, 1L, p_fname);
already_searched = FALSE;
if (new_fname != NULL)
{