0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.1602: Vim9: cannot use 'true" with getbufinfo()

Problem:    Vim9: cannot use 'true" with getbufinfo().
Solution:   Use dict_get_bool(). (closes #6873)
This commit is contained in:
Bram Moolenaar
2020-09-05 17:37:07 +02:00
parent 2df4731042
commit 036c2cf719
3 changed files with 14 additions and 15 deletions

View File

@@ -624,21 +624,11 @@ f_getbufinfo(typval_T *argvars, typval_T *rettv)
if (sel_d != NULL) if (sel_d != NULL)
{ {
dictitem_T *di;
filtered = TRUE; filtered = TRUE;
sel_buflisted = dict_get_bool(sel_d, (char_u *)"buflisted", FALSE);
di = dict_find(sel_d, (char_u *)"buflisted", -1); sel_bufloaded = dict_get_bool(sel_d, (char_u *)"bufloaded", FALSE);
if (di != NULL && tv_get_number(&di->di_tv)) sel_bufmodified = dict_get_bool(sel_d, (char_u *)"bufmodified",
sel_buflisted = TRUE; FALSE);
di = dict_find(sel_d, (char_u *)"bufloaded", -1);
if (di != NULL && tv_get_number(&di->di_tv))
sel_bufloaded = TRUE;
di = dict_find(sel_d, (char_u *)"bufmodified", -1);
if (di != NULL && tv_get_number(&di->di_tv))
sel_bufmodified = TRUE;
} }
} }
else if (argvars[0].v_type != VAR_UNKNOWN) else if (argvars[0].v_type != VAR_UNKNOWN)

View File

@@ -1493,9 +1493,16 @@ def Test_bufname()
close close
enddef enddef
def Test_gebufinfo() def Test_getbufinfo()
let bufinfo = getbufinfo(bufnr()) let bufinfo = getbufinfo(bufnr())
assert_equal(bufinfo, getbufinfo('%')) assert_equal(bufinfo, getbufinfo('%'))
edit Xtestfile1
hide edit Xtestfile2
hide enew
getbufinfo(#{bufloaded: true, buflisted: true, bufmodified: false})
->len()->assert_equal(3)
bwipe Xtestfile1 Xtestfile2
enddef enddef
def Fibonacci(n: number): number def Fibonacci(n: number): number

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1602,
/**/ /**/
1601, 1601,
/**/ /**/