Skip to content

Commit

Permalink
Two fixes for :find completion and more testing. (Nazri Ramliy)
Browse files Browse the repository at this point in the history
--HG--
branch : vim73
  • Loading branch information
brammool committed Aug 15, 2010
1 parent 6926154 commit 9637f8e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/misc1.c
Expand Up @@ -9722,6 +9722,9 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags)
char_u *p;
static int recursive = FALSE;
int add_pat;
#if defined(FEAT_SEARCHPATH)
int did_expand_in_path = FALSE;
#endif

/*
* expand_env() is called to expand things like "~user". If this fails,
Expand Down Expand Up @@ -9808,12 +9811,19 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags)
if (mch_has_exp_wildcard(p))
{
#if defined(FEAT_SEARCHPATH)
if (*p != '.' && !vim_ispathsep(*p) && (flags & EW_PATH))
if ((flags & EW_PATH)
&& !mch_isFullName(p)
&& !(p[0] == '.'
&& (vim_ispathsep(p[1])
|| (p[1] == '.' && vim_ispathsep(p[2]))))
)
{
/* recursiveness is OK here */
/* :find completion where 'path' is used.
* Recursiveness is OK here. */
recursive = FALSE;
add_pat = expand_in_path(&ga, p, flags);
recursive = TRUE;
did_expand_in_path = TRUE;
}
else
#endif
Expand All @@ -9838,7 +9848,7 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags)
}

#if defined(FEAT_SEARCHPATH)
if (ga.ga_len > 0 && (flags & EW_PATH))
if (did_expand_in_path && ga.ga_len > 0 && (flags & EW_PATH))
uniquefy_paths(&ga, p);
#endif
if (p != pat[i])
Expand Down
8 changes: 8 additions & 0 deletions src/testdir/test73.in
Expand Up @@ -150,6 +150,14 @@ SVoyager 2:w
:exec "cd " . cwd . "/Xfind/in"
:find file
:exec "w >>" . test_out
:" Test for relative to current buffer 'path' item
:exec "cd " . cwd . "/Xfind/"
:set path=./path
:" Open the file where Jimmy Hoffa is found
:e in/file.txt
:" Find the file containing 'E.T.' in the Xfind/in/path directory
:find file
:exec "w >>" . test_out
:q
:exec "cd " . cwd
:call DeleteDirectory("Xfind")
Expand Down
1 change: 1 addition & 0 deletions src/testdir/test73.ok
Expand Up @@ -16,3 +16,4 @@ Voyager 1
Voyager 1
Voyager 2
Jimmy Hoffa
E.T.

0 comments on commit 9637f8e

Please sign in to comment.