mirror of
https://github.com/neovim/neovim.git
synced 2025-10-04 17:06:30 +00:00
fix(eval/f_getmatches): return empty list for invalid win argument (#18893)
Slight inaccuracy in v8.1.1084's port. Like Vim, it should return [], not 0. Ref #18890
This commit is contained in:
@@ -3214,7 +3214,7 @@ getmatches([{win}]) *getmatches()*
|
|||||||
|getmatches()|.
|
|getmatches()|.
|
||||||
If {win} is specified, use the window with this number or
|
If {win} is specified, use the window with this number or
|
||||||
window ID instead of the current window. If {win} is invalid,
|
window ID instead of the current window. If {win} is invalid,
|
||||||
`0` is returned.
|
an empty list is returned.
|
||||||
Example: >
|
Example: >
|
||||||
:echo getmatches()
|
:echo getmatches()
|
||||||
< [{'group': 'MyGroup1', 'pattern': 'TODO',
|
< [{'group': 'MyGroup1', 'pattern': 'TODO',
|
||||||
|
@@ -873,11 +873,11 @@ void f_getmatches(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
int i;
|
int i;
|
||||||
win_T *win = get_optional_window(argvars, 0);
|
win_T *win = get_optional_window(argvars, 0);
|
||||||
|
|
||||||
|
tv_list_alloc_ret(rettv, kListLenMayKnow);
|
||||||
if (win == NULL) {
|
if (win == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tv_list_alloc_ret(rettv, kListLenMayKnow);
|
|
||||||
cur = win->w_match_head;
|
cur = win->w_match_head;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
dict_T *dict = tv_dict_alloc();
|
dict_T *dict = tv_dict_alloc();
|
||||||
|
Reference in New Issue
Block a user