]> granicus.if.org Git - vim/commitdiff
Two fixes for :find completion and more testing. (Nazri Ramliy)
authorBram Moolenaar <Bram@vim.org>
Sun, 15 Aug 2010 11:29:11 +0000 (13:29 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 15 Aug 2010 11:29:11 +0000 (13:29 +0200)
src/misc1.c
src/testdir/test73.in
src/testdir/test73.ok

index c4a6015a0d1cf9e6b5d81b594d418e7db286e49d..fd178c99dc72adb04215ed7cfa39e315db8365b4 100644 (file)
@@ -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,
@@ -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
@@ -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])
index 3518e8087f938a457ecad4cefd888cd5c31af08c..5472247e7476ff584a195cb67eb7745f7dcd25c2 100644 (file)
@@ -150,6 +150,14 @@ SVoyager 2\e: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")
index 4dd48fbac9bdb2873efab435dd7e952b94770def..366f951630a6fd9245cf901a1c3072cc61f51ec8 100644 (file)
@@ -16,3 +16,4 @@ Voyager 1
 Voyager 1
 Voyager 2
 Jimmy Hoffa
+E.T.