mirror of
https://github.com/neovim/neovim.git
synced 2025-10-01 07:28:34 +00:00
vim-patch:7.4.2205
Problem: 'wildignore' always applies to getcompletion().
Solution: Add an option to use 'wildignore' or not. (Yegappan Lakshmanan)
e9d58a6459
This commit is contained in:
@@ -1897,7 +1897,8 @@ getcmdline() String return the current command-line
|
|||||||
getcmdpos() Number return cursor position in command-line
|
getcmdpos() Number return cursor position in command-line
|
||||||
getcmdtype() String return current command-line type
|
getcmdtype() String return current command-line type
|
||||||
getcmdwintype() String return current command-line window type
|
getcmdwintype() String return current command-line window type
|
||||||
getcompletion({pat}, {type}) List list of cmdline completion matches
|
getcompletion({pat}, {type} [, {filtered}])
|
||||||
|
List list of cmdline completion matches
|
||||||
getcurpos() List position of the cursor
|
getcurpos() List position of the cursor
|
||||||
getcwd([{winnr} [, {tabnr}]]) String the current working directory
|
getcwd([{winnr} [, {tabnr}]]) String the current working directory
|
||||||
getfontname([{name}]) String name of font being used
|
getfontname([{name}]) String name of font being used
|
||||||
@@ -3651,7 +3652,7 @@ getcmdwintype() *getcmdwintype()*
|
|||||||
values are the same as |getcmdtype()|. Returns an empty string
|
values are the same as |getcmdtype()|. Returns an empty string
|
||||||
when not in the command-line window.
|
when not in the command-line window.
|
||||||
|
|
||||||
getcompletion({pat}, {type}) *getcompletion()*
|
getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
|
||||||
Return a list of command-line completion matches. {type}
|
Return a list of command-line completion matches. {type}
|
||||||
specifies what for. The following completion types are
|
specifies what for. The following completion types are
|
||||||
supported:
|
supported:
|
||||||
@@ -3691,6 +3692,10 @@ getcompletion({pat}, {type}) *getcompletion()*
|
|||||||
Otherwise only items matching {pat} are returned. See
|
Otherwise only items matching {pat} are returned. See
|
||||||
|wildcards| for the use of special characters in {pat}.
|
|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
|
If there are no matches, an empty list is returned. An
|
||||||
invalid value for {type} produces an error.
|
invalid value for {type} produces an error.
|
||||||
|
|
||||||
|
@@ -9648,13 +9648,23 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
{
|
{
|
||||||
char_u *pat;
|
char_u *pat;
|
||||||
expand_T xpc;
|
expand_T xpc;
|
||||||
|
bool filtered = false;
|
||||||
int options = WILD_SILENT | WILD_USE_NL | WILD_ADD_SLASH
|
int options = WILD_SILENT | WILD_USE_NL | WILD_ADD_SLASH
|
||||||
| WILD_NO_BEEP;
|
| WILD_NO_BEEP;
|
||||||
|
|
||||||
|
if (argvars[2].v_type != VAR_UNKNOWN) {
|
||||||
|
filtered = get_tv_number_chk(&argvars[2], NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (p_wic) {
|
if (p_wic) {
|
||||||
options |= WILD_ICASE;
|
options |= WILD_ICASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For filtered results, 'wildignore' is used
|
||||||
|
if (!filtered) {
|
||||||
|
options |= WILD_KEEP_ALL;
|
||||||
|
}
|
||||||
|
|
||||||
ExpandInit(&xpc);
|
ExpandInit(&xpc);
|
||||||
xpc.xp_pattern = get_tv_string(&argvars[0]);
|
xpc.xp_pattern = get_tv_string(&argvars[0]);
|
||||||
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
|
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
|
||||||
|
@@ -114,7 +114,7 @@ return {
|
|||||||
getcmdpos={},
|
getcmdpos={},
|
||||||
getcmdtype={},
|
getcmdtype={},
|
||||||
getcmdwintype={},
|
getcmdwintype={},
|
||||||
getcompletion={args=2},
|
getcompletion={args={2, 3}},
|
||||||
getcurpos={},
|
getcurpos={},
|
||||||
getcwd={args={0,2}},
|
getcwd={args={0,2}},
|
||||||
getfontname={args={0, 1}},
|
getfontname={args={0, 1}},
|
||||||
|
@@ -89,6 +89,10 @@ func Test_getcompletion()
|
|||||||
call assert_true(index(l, 'runtest.vim') >= 0)
|
call assert_true(index(l, 'runtest.vim') >= 0)
|
||||||
let l = getcompletion('walk', 'file')
|
let l = getcompletion('walk', 'file')
|
||||||
call assert_equal([], l)
|
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')
|
let l = getcompletion('ha', 'filetype')
|
||||||
call assert_true(index(l, 'hamster') >= 0)
|
call assert_true(index(l, 'hamster') >= 0)
|
||||||
|
@@ -236,7 +236,7 @@ static int included_patches[] = {
|
|||||||
// 2208,
|
// 2208,
|
||||||
// 2207 NA
|
// 2207 NA
|
||||||
// 2206 NA
|
// 2206 NA
|
||||||
// 2205,
|
2205,
|
||||||
// 2204,
|
// 2204,
|
||||||
// 2203 NA
|
// 2203 NA
|
||||||
// 2202 NA
|
// 2202 NA
|
||||||
|
Reference in New Issue
Block a user