updated for version 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.
diff --git a/src/os_unix.c b/src/os_unix.c
index 8f6b914..df045a5 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -3104,22 +3104,27 @@
/*
* Return 1 if "name" can be found in $PATH and executed, 0 if not.
+ * If "use_path" is FALSE only check if "name" is executable.
* Return -1 if unknown.
*/
int
-mch_can_exe(name, path)
+mch_can_exe(name, path, use_path)
char_u *name;
char_u **path;
+ int use_path;
{
char_u *buf;
char_u *p, *e;
int retval;
- /* If it's an absolute or relative path don't need to use $PATH. */
- if (mch_isFullName(name) || (name[0] == '.' && (name[1] == '/'
- || (name[1] == '.' && name[2] == '/'))))
+ /* When "use_path" is false and if it's an absolute or relative path don't
+ * need to use $PATH. */
+ if (!use_path || mch_isFullName(name) || (name[0] == '.'
+ && (name[1] == '/' || (name[1] == '.' && name[2] == '/'))))
{
- if (executable_file(name))
+ /* There must be a path separator, files in the current directory
+ * can't be executed. */
+ if (gettail(name) != name && executable_file(name))
{
if (path != NULL)
{
@@ -5730,7 +5735,8 @@
continue;
/* Skip files that are not executable if we check for that. */
- if (!dir && (flags & EW_EXEC) && !mch_can_exe(p, NULL))
+ if (!dir && (flags & EW_EXEC)
+ && !mch_can_exe(p, NULL, !(flags & EW_SHELLCMD)))
continue;
if (--files_free == 0)
@@ -6230,7 +6236,8 @@
continue;
/* Skip files that are not executable if we check for that. */
- if (!dir && (flags & EW_EXEC) && !mch_can_exe((*file)[i], NULL))
+ if (!dir && (flags & EW_EXEC)
+ && !mch_can_exe((*file)[i], NULL, !(flags & EW_SHELLCMD)))
continue;
p = alloc((unsigned)(STRLEN((*file)[i]) + 1 + dir));