0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

updated for version 7.3.399

Problem:    ":cd" doesn't work when the path contains wildcards. (Yukihiro
            Nakadaira)
Solution:   Ignore wildcard errors when the EW_NOTWILD flag is used.
This commit is contained in:
Bram Moolenaar 2012-01-10 18:37:58 +01:00
parent a0f299b4e8
commit 1f5965b3c4
2 changed files with 14 additions and 6 deletions

View File

@ -9103,15 +9103,15 @@ dos_expandpath(
} }
/* compile the regexp into a program */ /* compile the regexp into a program */
if (flags & EW_NOERROR) if (flags & (EW_NOERROR | EW_NOTWILD))
++emsg_silent; ++emsg_silent;
regmatch.rm_ic = TRUE; /* Always ignore case */ regmatch.rm_ic = TRUE; /* Always ignore case */
regmatch.regprog = vim_regcomp(pat, RE_MAGIC); regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
if (flags & EW_NOERROR) if (flags & (EW_NOERROR | EW_NOTWILD))
--emsg_silent; --emsg_silent;
vim_free(pat); vim_free(pat);
if (regmatch.regprog == NULL) if (regmatch.regprog == NULL && (flags & EW_NOTWILD) == 0)
{ {
vim_free(buf); vim_free(buf);
return 0; return 0;
@ -9179,7 +9179,8 @@ dos_expandpath(
* all entries found with "matchname". */ * all entries found with "matchname". */
if ((p[0] != '.' || starts_with_dot) if ((p[0] != '.' || starts_with_dot)
&& (matchname == NULL && (matchname == NULL
|| vim_regexec(&regmatch, p, (colnr_T)0) || (regmatch.regprog != NULL
&& vim_regexec(&regmatch, p, (colnr_T)0))
|| ((flags & EW_NOTWILD) || ((flags & EW_NOTWILD)
&& fnamencmp(path + (s - buf), p, e - s) == 0))) && fnamencmp(path + (s - buf), p, e - s) == 0)))
{ {
@ -9419,10 +9420,14 @@ unix_expandpath(gap, path, wildoff, flags, didstar)
else else
regmatch.rm_ic = FALSE; /* Don't ignore case */ regmatch.rm_ic = FALSE; /* Don't ignore case */
#endif #endif
if (flags & (EW_NOERROR | EW_NOTWILD))
++emsg_silent;
regmatch.regprog = vim_regcomp(pat, RE_MAGIC); regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
if (flags & (EW_NOERROR | EW_NOTWILD))
--emsg_silent;
vim_free(pat); vim_free(pat);
if (regmatch.regprog == NULL) if (regmatch.regprog == NULL && (flags & EW_NOTWILD) == 0)
{ {
vim_free(buf); vim_free(buf);
return 0; return 0;
@ -9452,7 +9457,8 @@ unix_expandpath(gap, path, wildoff, flags, didstar)
if (dp == NULL) if (dp == NULL)
break; break;
if ((dp->d_name[0] != '.' || starts_with_dot) if ((dp->d_name[0] != '.' || starts_with_dot)
&& (vim_regexec(&regmatch, (char_u *)dp->d_name, (colnr_T)0) && ((regmatch.regprog != NULL && vim_regexec(&regmatch,
(char_u *)dp->d_name, (colnr_T)0))
|| ((flags & EW_NOTWILD) || ((flags & EW_NOTWILD)
&& fnamencmp(path + (s - buf), dp->d_name, e - s) == 0))) && fnamencmp(path + (s - buf), dp->d_name, e - s) == 0)))
{ {

View File

@ -714,6 +714,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
399,
/**/ /**/
398, 398,
/**/ /**/