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.

b5971141df

Most of it applied manually.
This commit is contained in:
KillTheMule
2016-04-29 21:17:06 +02:00
parent d542de4a76
commit 00c35ab3b4
8 changed files with 47 additions and 20 deletions

View File

@@ -3983,6 +3983,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
char_u *s, *e;
int flags = flagsarg;
int ret;
bool did_curdir = false;
/* for ":set path=" and ":set tags=" halve backslashes for escaped
* space */
@@ -3991,7 +3992,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
if (pat[i] == '\\' && pat[i + 1] == ' ')
STRMOVE(pat + i, pat + i + 1);
flags |= EW_FILE | EW_EXEC;
flags |= EW_FILE | EW_EXEC | EW_SHELLCMD;
bool mustfree = false; // Track memory allocation for *path.
/* For an absolute name we don't use $PATH. */
@@ -4011,10 +4012,23 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
/*
* Go over all directories in $PATH. Expand matches in that directory and
* collect them in "ga".
* collect them in "ga". When "." is not in $PATH also expaned for the
* current directory, to find "subdir/cmd".
*/
ga_init(&ga, (int)sizeof(char *), 10);
for (s = path; *s != NUL; s = e) {
for (s = path; ; s = e) {
if (*s == NUL)
{
if (did_curdir) {
break;
}
// Find directories in the current directory, path is empty.
did_curdir = true;
}
else if (*s == '.') {
did_curdir = true;
}
if (*s == ' ')
++s; /* Skip space used for absolute path name. */