mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 23:38:17 +00:00
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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user