diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-08-13 15:07:41 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-08-13 15:07:41 +0200 |
commit | e9d58a6459687a1228b5aa85bd7b31f8f1e528a8 (patch) | |
tree | 0ebad4df9b44984195bce5810eba4191a7180d93 /src | |
parent | 0952131376a517fc12dc5ae908a97018b4ee23f0 (diff) |
patch 7.4.2205v7.4.2205
Problem: 'wildignore' always applies to getcompletion().
Solution: Add an option to use 'wildignore' or not. (Yegappan Lakshmanan)
Diffstat (limited to 'src')
-rw-r--r-- | src/evalfunc.c | 10 | ||||
-rw-r--r-- | src/testdir/test_cmdline.vim | 4 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index ab4f9fd15f..379bc634fc 100644 --- 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, typval_T *rettv) { 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); diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index e2c1876934..3a35637b7e 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -94,6 +94,10 @@ func Test_getcompletion() 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) diff --git a/src/version.c b/src/version.c index 11ab8f6f10..dd7b4b7351 100644 --- a/src/version.c +++ b/src/version.c @@ -764,6 +764,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2205, +/**/ 2204, /**/ 2203, |