aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/path.c
diff options
context:
space:
mode:
authorKillTheMule <KillTheMule@users.noreply.github.com>2016-04-29 21:17:06 +0200
committerKillTheMule <KillTheMule@users.noreply.github.com>2016-05-02 21:09:43 +0200
commit00c35ab3b4d8498c82776525de7b1afcd7b3424a (patch)
treefce72ff6c7a1adf88952c57ddb6c78246fc41c2d /src/nvim/path.c
parentd542de4a76dd9e600ebcf1405efdc9d3090ad9a8 (diff)
downloadrneovim-00c35ab3b4d8498c82776525de7b1afcd7b3424a.tar.gz
rneovim-00c35ab3b4d8498c82776525de7b1afcd7b3424a.tar.bz2
rneovim-00c35ab3b4d8498c82776525de7b1afcd7b3424a.zip
vim-patch:7.4.672
Problem: When completing a shell command, directories in the current directory are not listed. Solution: When "." is not in $PATH also look in the current directory for directories. https://github.com/vim/vim/commit/b5971141dff0c69355fd64196fcc0d0d071d4c82 Most of it applied manually.
Diffstat (limited to 'src/nvim/path.c')
-rw-r--r--src/nvim/path.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 80ad643aa1..252e9430ec 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -981,12 +981,12 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
* "/path/file", "/path/dir/", "/path//dir", "/file"
* ^ ^ ^ ^
*/
-static char_u *gettail_dir(char_u *fname)
+char_u *gettail_dir(const char_u *fname)
{
- char_u *dir_end = fname;
- char_u *next_dir_end = fname;
+ const char_u *dir_end = fname;
+ const char_u *next_dir_end = fname;
bool look_for_sep = true;
- char_u *p;
+ const char_u *p;
for (p = fname; *p != NUL; ) {
if (vim_ispathsep(*p)) {
@@ -1001,7 +1001,7 @@ static char_u *gettail_dir(char_u *fname)
}
mb_ptr_adv(p);
}
- return dir_end;
+ return (char_u *)dir_end;
}
@@ -1318,8 +1318,10 @@ void addfile(
if ((isdir && !(flags & EW_DIR)) || (!isdir && !(flags & EW_FILE)))
return;
- /* If the file isn't executable, may not add it. Do accept directories. */
- if (!isdir && (flags & EW_EXEC) && !os_can_exe(f, NULL))
+ // If the file isn't executable, may not add it. Do accept directories.
+ // When invoked from expand_shellcmd() do not use $PATH.
+ if (!isdir && (flags & EW_EXEC)
+ && !os_can_exe(f, NULL, !(flags & EW_SHELLCMD)))
return;
char_u *p = xmalloc(STRLEN(f) + 1 + isdir);