To: vim_dev@googlegroups.com Subject: Patch 7.4.2205 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2205 Problem: 'wildignore' always applies to getcompletion(). Solution: Add an option to use 'wildignore' or not. (Yegappan Lakshmanan) Files: runtime/doc/eval.txt, src/evalfunc.c, src/testdir/test_cmdline.vim *** ../vim-7.4.2204/runtime/doc/eval.txt 2016-08-12 22:22:01.164781986 +0200 --- runtime/doc/eval.txt 2016-08-13 14:25:19.494958239 +0200 *************** *** 2072,2078 **** getcmdpos() Number return cursor position in command-line getcmdtype() String return current command-line type getcmdwintype() String return current command-line window type ! getcompletion({pat}, {type}) List list of cmdline completion matches getcurpos() List position of the cursor getcwd([{winnr} [, {tabnr}]]) String get the current working directory getfontname([{name}]) String name of font being used --- 2093,2100 ---- getcmdpos() Number return cursor position in command-line getcmdtype() String return current command-line type getcmdwintype() String return current command-line window type ! getcompletion({pat}, {type} [, {filtered}]) ! List list of cmdline completion matches getcurpos() List position of the cursor getcwd([{winnr} [, {tabnr}]]) String get the current working directory getfontname([{name}]) String name of font being used *************** *** 4170,4176 **** values are the same as |getcmdtype()|. Returns an empty string when not in the command-line window. ! getcompletion({pat}, {type}) *getcompletion()* Return a list of command-line completion matches. {type} specifies what for. The following completion types are supported: --- 4212,4218 ---- values are the same as |getcmdtype()|. Returns an empty string when not in the command-line window. ! getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* Return a list of command-line completion matches. {type} specifies what for. The following completion types are supported: *************** *** 4210,4215 **** --- 4252,4261 ---- Otherwise only items matching {pat} are returned. See |wildcards| for the use of special characters in {pat}. + If the optional {filtered} flag is set to 1, then 'wildignore' + is applied to filter the results. Otherwise all the matches + are returned. The 'wildignorecase' option always applies. + If there are no matches, an empty list is returned. An invalid value for {type} produces an error. *** ../vim-7.4.2204/src/evalfunc.c 2016-08-12 22:22:01.168781950 +0200 --- src/evalfunc.c 2016-08-13 14:25:19.498958203 +0200 *************** *** 586,592 **** {"getcmdtype", 0, 0, f_getcmdtype}, {"getcmdwintype", 0, 0, f_getcmdwintype}, #if defined(FEAT_CMDL_COMPL) ! {"getcompletion", 2, 2, f_getcompletion}, #endif {"getcurpos", 0, 0, f_getcurpos}, {"getcwd", 0, 2, f_getcwd}, --- 586,592 ---- {"getcmdtype", 0, 0, f_getcmdtype}, {"getcmdwintype", 0, 0, f_getcmdwintype}, #if defined(FEAT_CMDL_COMPL) ! {"getcompletion", 2, 3, f_getcompletion}, #endif {"getcurpos", 0, 0, f_getcurpos}, {"getcwd", 0, 2, f_getcwd}, *************** *** 4382,4393 **** --- 4382,4401 ---- { 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); *** ../vim-7.4.2204/src/testdir/test_cmdline.vim 2016-08-06 14:12:44.950591485 +0200 --- src/testdir/test_cmdline.vim 2016-08-13 14:35:23.841483116 +0200 *************** *** 94,99 **** --- 94,103 ---- call assert_true(index(l, 'runtest.vim') >= 0) let l = getcompletion('walk', 'file') call assert_equal([], l) + set wildignore=*.vim + let l = getcompletion('run', 'file', 1) + call assert_true(index(l, 'runtest.vim') < 0) + set wildignore& let l = getcompletion('ha', 'filetype') call assert_true(index(l, 'hamster') >= 0) *** ../vim-7.4.2204/src/version.c 2016-08-12 22:22:01.176781877 +0200 --- src/version.c 2016-08-13 14:26:44.206189840 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2205, /**/ -- hundred-and-one symptoms of being an internet addict: 16. You step out of your room and realize that your parents have moved and you don't have a clue when it happened. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///