diff options
author | Bram Moolenaar <Bram@vim.org> | 2015-03-05 19:35:25 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2015-03-05 19:35:25 +0100 |
commit | a245bc79b4c6b83a4b5b6cdb95c4d2165762a20b (patch) | |
tree | dbb5a71da4718b7404caf85eb3e2c1a011fa9e34 /src | |
parent | e421450a5ef8c6327fcc9b90a5c3d6b26b274830 (diff) |
updated for version 7.4.654v7.4.654
Problem: glob() and globpath() cannot include links to non-existing files.
(Charles Campbell)
Solution: Add an argument to include all links with glob(). (James McCoy)
Also for globpath().
Diffstat (limited to 'src')
-rw-r--r-- | src/eval.c | 30 | ||||
-rw-r--r-- | src/ex_getln.c | 2 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim.h | 20 |
4 files changed, 35 insertions, 19 deletions
diff --git a/src/eval.c b/src/eval.c index 508a26c1fa..cb584f8b8e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -8141,8 +8141,8 @@ static struct fst {"getwinposx", 0, 0, f_getwinposx}, {"getwinposy", 0, 0, f_getwinposy}, {"getwinvar", 2, 3, f_getwinvar}, - {"glob", 1, 3, f_glob}, - {"globpath", 2, 4, f_globpath}, + {"glob", 1, 4, f_glob}, + {"globpath", 2, 5, f_globpath}, {"has", 1, 1, f_has}, {"has_key", 2, 2, f_has_key}, {"haslocaldir", 0, 0, f_haslocaldir}, @@ -12412,11 +12412,16 @@ f_glob(argvars, rettv) { if (get_tv_number_chk(&argvars[1], &error)) options |= WILD_KEEP_ALL; - if (argvars[2].v_type != VAR_UNKNOWN - && get_tv_number_chk(&argvars[2], &error)) + if (argvars[2].v_type != VAR_UNKNOWN) { - rettv->v_type = VAR_LIST; - rettv->vval.v_list = NULL; + if (get_tv_number_chk(&argvars[2], &error)) + { + rettv->v_type = VAR_LIST; + rettv->vval.v_list = NULL; + } + if (argvars[3].v_type != VAR_UNKNOWN + && get_tv_number_chk(&argvars[3], &error)) + options |= WILD_ALLLINKS; } } if (!error) @@ -12466,11 +12471,16 @@ f_globpath(argvars, rettv) { if (get_tv_number_chk(&argvars[2], &error)) flags |= WILD_KEEP_ALL; - if (argvars[3].v_type != VAR_UNKNOWN - && get_tv_number_chk(&argvars[3], &error)) + if (argvars[3].v_type != VAR_UNKNOWN) { - rettv->v_type = VAR_LIST; - rettv->vval.v_list = NULL; + if (get_tv_number_chk(&argvars[3], &error)) + { + rettv->v_type = VAR_LIST; + rettv->vval.v_list = NULL; + } + if (argvars[4].v_type != VAR_UNKNOWN + && get_tv_number_chk(&argvars[4], &error)) + flags |= WILD_ALLLINKS; } } if (file != NULL && !error) diff --git a/src/ex_getln.c b/src/ex_getln.c index d8db15abf6..e18a8ede93 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -4563,6 +4563,8 @@ ExpandFromContext(xp, pat, num_file, file, options) flags |= EW_KEEPALL; if (options & WILD_SILENT) flags |= EW_SILENT; + if (options & WILD_ALLLINKS) + flags |= EW_ALLLINKS; if (xp->xp_context == EXPAND_FILES || xp->xp_context == EXPAND_DIRECTORIES diff --git a/src/version.c b/src/version.c index b106503413..a814baf361 100644 --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 654, +/**/ 653, /**/ 652, @@ -814,15 +814,16 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define WILD_LONGEST 7 #define WILD_ALL_KEEP 8 -#define WILD_LIST_NOTFOUND 1 -#define WILD_HOME_REPLACE 2 -#define WILD_USE_NL 4 -#define WILD_NO_BEEP 8 -#define WILD_ADD_SLASH 16 -#define WILD_KEEP_ALL 32 -#define WILD_SILENT 64 -#define WILD_ESCAPE 128 -#define WILD_ICASE 256 +#define WILD_LIST_NOTFOUND 0x01 +#define WILD_HOME_REPLACE 0x02 +#define WILD_USE_NL 0x04 +#define WILD_NO_BEEP 0x08 +#define WILD_ADD_SLASH 0x10 +#define WILD_KEEP_ALL 0x20 +#define WILD_SILENT 0x40 +#define WILD_ESCAPE 0x80 +#define WILD_ICASE 0x100 +#define WILD_ALLLINKS 0x200 /* Flags for expand_wildcards() */ #define EW_DIR 0x01 /* include directory names */ @@ -839,6 +840,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define EW_KEEPDOLLAR 0x800 /* do not escape $, $var is expanded */ /* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND * is used when executing commands and EW_SILENT for interactive expanding. */ +#define EW_ALLLINKS 0x1000 /* also links not pointing to existing file */ /* Flags for find_file_*() functions. */ #define FINDFILE_FILE 0 /* only files */ |