diff src/evalfunc.c @ 9861:74f67cb4f7e1 v7.4.2205

commit https://github.com/vim/vim/commit/e9d58a6459687a1228b5aa85bd7b31f8f1e528a8 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 13 15:07:41 2016 +0200 patch 7.4.2205 Problem: 'wildignore' always applies to getcompletion(). Solution: Add an option to use 'wildignore' or not. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Sat, 13 Aug 2016 15:15:04 +0200
parents 3e96d9ed2ca1
children cbe23f6769f9
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -586,7 +586,7 @@ static struct fst
     {"getcmdtype",	0, 0, f_getcmdtype},
     {"getcmdwintype",	0, 0, f_getcmdwintype},
 #if defined(FEAT_CMDL_COMPL)
-    {"getcompletion",	2, 2, f_getcompletion},
+    {"getcompletion",	2, 3, f_getcompletion},
 #endif
     {"getcurpos",	0, 0, f_getcurpos},
     {"getcwd",		0, 2, f_getcwd},
@@ -4382,12 +4382,20 @@ f_getcompletion(typval_T *argvars, typva
 {
     char_u	*pat;
     expand_T	xpc;
+    int		filtered = FALSE;
     int		options = WILD_SILENT | WILD_USE_NL | WILD_ADD_SLASH
 					| WILD_NO_BEEP;
 
+    if (argvars[2].v_type != VAR_UNKNOWN)
+	filtered = get_tv_number_chk(&argvars[2], NULL);
+
     if (p_wic)
 	options |= WILD_ICASE;
 
+    /* For filtered results, 'wildignore' is used */
+    if (!filtered)
+	options |= WILD_KEEP_ALL;
+
     ExpandInit(&xpc);
     xpc.xp_pattern = get_tv_string(&argvars[0]);
     xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);