aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-11-25 00:34:52 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-11-25 03:29:49 -0500
commit226ad89a2cf46b9a11a38b3236e23bd3e4c9b94a (patch)
tree477d54dd8d6bdc0463baf8a17e16867a42a8e8f1 /src/nvim/ex_getln.c
parent7a0a2eb310a5568d6ee743d65f5ae12f60111c6e (diff)
downloadrneovim-226ad89a2cf46b9a11a38b3236e23bd3e4c9b94a.tar.gz
rneovim-226ad89a2cf46b9a11a38b3236e23bd3e4c9b94a.tar.bz2
rneovim-226ad89a2cf46b9a11a38b3236e23bd3e4c9b94a.zip
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) https://github.com/vim/vim/commit/6ab9e429da18f4d784222a9f7dfafb7c0218b7eb
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r--src/nvim/ex_getln.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 9e2671ca5e..7948da5e6b 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -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);