vim-patch:8.1.0223: completing shell command finds sub-directories in $PATH

Problem:    Completing shell command finds sub-directories in $PATH.
Solution:   Remove EW_DIR when completing an item in $PATH. (Jason Franklin)
6ab9e429da
This commit is contained in:
Jan Edmund Lazo
2019-11-25 00:34:52 -05:00
parent 7a0a2eb310
commit 226ad89a2c
2 changed files with 35 additions and 7 deletions

View File

@@ -5008,19 +5008,24 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
hashtab_T found_ht;
hash_init(&found_ht);
for (s = path; ; s = e) {
e = vim_strchr(s, ENV_SEPCHAR);
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;
} else if (*s == '.') {
flags |= EW_DIR;
} else if (STRNCMP(s, ".", e - s) == 0) {
did_curdir = true;
}
e = vim_strchr(s, ENV_SEPCHAR);
if (e == NULL) {
e = s + STRLEN(s);
flags |= EW_DIR;
} else {
// Do not match directories inside a $PATH item.
flags &= ~EW_DIR;
}
l = (size_t)(e - s);