updated for version 7.2-051
diff --git a/src/eval.c b/src/eval.c
index 00190b0..e118f04 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -7564,8 +7564,8 @@
{"getwinposx", 0, 0, f_getwinposx},
{"getwinposy", 0, 0, f_getwinposy},
{"getwinvar", 2, 2, f_getwinvar},
- {"glob", 1, 1, f_glob},
- {"globpath", 2, 2, f_globpath},
+ {"glob", 1, 2, f_glob},
+ {"globpath", 2, 3, f_globpath},
{"has", 1, 1, f_has},
{"has_key", 2, 2, f_has_key},
{"haslocaldir", 0, 0, f_haslocaldir},
@@ -9557,7 +9557,7 @@
else
{
/* When the optional second argument is non-zero, don't remove matches
- * for 'suffixes' and 'wildignore' */
+ * for 'wildignore' and don't put matches for 'suffixes' at the end. */
if (argvars[1].v_type != VAR_UNKNOWN
&& get_tv_number_chk(&argvars[1], &error))
flags |= WILD_KEEP_ALL;
@@ -11323,13 +11323,25 @@
typval_T *argvars;
typval_T *rettv;
{
+ int flags = WILD_SILENT|WILD_USE_NL;
expand_T xpc;
+ int error = FALSE;
- ExpandInit(&xpc);
- xpc.xp_context = EXPAND_FILES;
+ /* When the optional second argument is non-zero, don't remove matches
+ * for 'wildignore' and don't put matches for 'suffixes' at the end. */
+ if (argvars[1].v_type != VAR_UNKNOWN
+ && get_tv_number_chk(&argvars[1], &error))
+ flags |= WILD_KEEP_ALL;
rettv->v_type = VAR_STRING;
- rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
- NULL, WILD_USE_NL|WILD_SILENT, WILD_ALL);
+ if (!error)
+ {
+ ExpandInit(&xpc);
+ xpc.xp_context = EXPAND_FILES;
+ rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
+ NULL, flags, WILD_ALL);
+ }
+ else
+ rettv->vval.v_string = NULL;
}
/*
@@ -11340,14 +11352,22 @@
typval_T *argvars;
typval_T *rettv;
{
+ int flags = 0;
char_u buf1[NUMBUFLEN];
char_u *file = get_tv_string_buf_chk(&argvars[1], buf1);
+ int error = FALSE;
+ /* When the optional second argument is non-zero, don't remove matches
+ * for 'wildignore' and don't put matches for 'suffixes' at the end. */
+ if (argvars[2].v_type != VAR_UNKNOWN
+ && get_tv_number_chk(&argvars[2], &error))
+ flags |= WILD_KEEP_ALL;
rettv->v_type = VAR_STRING;
- if (file == NULL)
+ if (file == NULL || error)
rettv->vval.v_string = NULL;
else
- rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file);
+ rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file,
+ flags);
}
/*
diff --git a/src/ex_getln.c b/src/ex_getln.c
index ac801eb..e324e7e 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -2524,7 +2524,7 @@
&& ccline.xpc->xp_context != EXPAND_NOTHING
&& ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
{
- int i = ccline.xpc->xp_pattern - p;
+ int i = (int)(ccline.xpc->xp_pattern - p);
/* If xp_pattern points inside the old cmdbuff it needs to be adjusted
* to point into the newly allocated memory. */
@@ -4897,7 +4897,7 @@
if (s == NULL)
return FAIL;
sprintf((char *)s, "%s/%s*.vim", dirname, pat);
- all = globpath(p_rtp, s);
+ all = globpath(p_rtp, s, 0);
vim_free(s);
if (all == NULL)
return FAIL;
@@ -4938,9 +4938,10 @@
* newlines. Returns NULL for an error or no matches.
*/
char_u *
-globpath(path, file)
+globpath(path, file, expand_options)
char_u *path;
char_u *file;
+ int expand_options;
{
expand_T xpc;
char_u *buf;
@@ -4969,10 +4970,10 @@
{
add_pathsep(buf);
STRCAT(buf, file);
- if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL
- && num_p > 0)
+ if (ExpandFromContext(&xpc, buf, &num_p, &p,
+ WILD_SILENT|expand_options) != FAIL && num_p > 0)
{
- ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT);
+ ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options);
for (len = 0, i = 0; i < num_p; ++i)
len += (int)STRLEN(p[i]) + 1;
diff --git a/src/proto/ex_getln.pro b/src/proto/ex_getln.pro
index b4a5018..afbf664 100644
--- a/src/proto/ex_getln.pro
+++ b/src/proto/ex_getln.pro
@@ -31,7 +31,7 @@
void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
-char_u *globpath __ARGS((char_u *path, char_u *file));
+char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options));
void init_history __ARGS((void));
int get_histtype __ARGS((char_u *name));
void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
diff --git a/src/version.c b/src/version.c
index e2e492a..e45bd12 100644
--- a/src/version.c
+++ b/src/version.c
@@ -677,6 +677,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 51,
+/**/
50,
/**/
49,