mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 16:58:17 +00:00
vim-patch:8.0.1029: return value of getqflist() is inconsistent
Problem: Return value of getqflist() is inconsistent. (Lcd47)
Solution: Always return an "items" entry.
da73253a0b
This commit is contained in:
@@ -4131,19 +4131,20 @@ static int qf_get_list_from_text(dictitem_T *di, dict_T *retdict)
|
|||||||
&& di->di_tv.vval.v_string != NULL)
|
&& di->di_tv.vval.v_string != NULL)
|
||||||
|| (di->di_tv.v_type == VAR_LIST
|
|| (di->di_tv.v_type == VAR_LIST
|
||||||
&& di->di_tv.vval.v_list != NULL)) {
|
&& di->di_tv.vval.v_list != NULL)) {
|
||||||
|
list_T *l = tv_list_alloc(kListLenMayKnow);
|
||||||
qf_info_T *qi = xmalloc(sizeof(*qi));
|
qf_info_T *qi = xmalloc(sizeof(*qi));
|
||||||
memset(qi, 0, sizeof(*qi));
|
memset(qi, 0, sizeof(*qi));
|
||||||
qi->qf_refcount++;
|
qi->qf_refcount++;
|
||||||
|
|
||||||
if (qf_init_ext(qi, 0, NULL, NULL, &di->di_tv, p_efm,
|
if (qf_init_ext(qi, 0, NULL, NULL, &di->di_tv, p_efm,
|
||||||
true, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) {
|
true, (linenr_T)0, (linenr_T)0, NULL, NULL) > 0) {
|
||||||
list_T *l = tv_list_alloc(kListLenMayKnow);
|
|
||||||
(void)get_errorlist(qi, NULL, 0, l);
|
(void)get_errorlist(qi, NULL, 0, l);
|
||||||
tv_dict_add_list(retdict, S_LEN("items"), l);
|
|
||||||
status = OK;
|
|
||||||
qf_free(qi, 0);
|
qf_free(qi, 0);
|
||||||
}
|
}
|
||||||
xfree(qi);
|
xfree(qi);
|
||||||
|
|
||||||
|
tv_dict_add_list(retdict, S_LEN("items"), l);
|
||||||
|
status = OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
@@ -2518,7 +2518,7 @@ func XgetListFromText(cchar)
|
|||||||
call assert_equal(30, l[1].lnum)
|
call assert_equal(30, l[1].lnum)
|
||||||
|
|
||||||
call assert_equal({}, g:Xgetlist({'text' : 10}))
|
call assert_equal({}, g:Xgetlist({'text' : 10}))
|
||||||
call assert_equal({}, g:Xgetlist({'text' : []}))
|
call assert_equal([], g:Xgetlist({'text' : []}).items)
|
||||||
|
|
||||||
" Make sure that the quickfix stack is not modified
|
" Make sure that the quickfix stack is not modified
|
||||||
call assert_equal(0, g:Xgetlist({'nr' : '$'}).nr)
|
call assert_equal(0, g:Xgetlist({'nr' : '$'}).nr)
|
||||||
|
Reference in New Issue
Block a user