summaryrefslogtreecommitdiffstats
path: root/src/ex_getln.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-07-28 19:20:13 +0200
committerBram Moolenaar <Bram@vim.org>2018-07-28 19:20:13 +0200
commit6ab9e429da18f4d784222a9f7dfafb7c0218b7eb (patch)
treeeedfdb81ae149bcbbc0696964bad1a4db077b830 /src/ex_getln.c
parent73b4abae5d47fe7e8b5829aaa0abe5b1eac8a408 (diff)
patch 8.1.0223: completing shell command finds sub-directories in $PATHv8.1.0223
Problem: Completing shell command finds sub-directories in $PATH. Solution: Remove EW_DIR when completing an item in $PATH. (Jason Franklin)
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r--src/ex_getln.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 063900a388..e659c1a8c2 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -5193,16 +5193,6 @@ expand_shellcmd(
hash_init(&found_ht);
for (s = path; ; s = e)
{
- if (*s == NUL)
- {
- if (did_curdir)
- break;
- /* Find directories in the current directory, path is empty. */
- did_curdir = TRUE;
- }
- else if (*s == '.')
- did_curdir = TRUE;
-
#if defined(MSWIN)
e = vim_strchr(s, ';');
#else
@@ -5211,6 +5201,23 @@ expand_shellcmd(
if (e == NULL)
e = s + STRLEN(s);
+ if (*s == NUL)
+ {
+ if (did_curdir)
+ break;
+ // Find directories in the current directory, path is empty.
+ did_curdir = TRUE;
+ flags |= EW_DIR;
+ }
+ else if (STRNCMP(s, ".", (int)(e - s)) == 0)
+ {
+ did_curdir = TRUE;
+ flags |= EW_DIR;
+ }
+ else
+ // Do not match directories inside a $PATH item.
+ flags &= ~EW_DIR;
+
l = e - s;
if (l > MAXPATHL - 5)
break;
@@ -5266,8 +5273,6 @@ expand_shellcmd(
# if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL)
-static void * call_user_expand_func(void *(*user_expand_func)(char_u *, int, typval_T *, int), expand_T *xp, int *num_file, char_u ***file);
-
/*
* Call "user_expand_func()" to invoke a user defined Vim script function and
* return the result (either a string or a List).