Skip to content

Commit 401f0c0

Browse files
committed
patch 8.2.1618: Vim9: cannot pass "true" to setloclist()
Problem: Vim9: cannot pass "true" to setloclist(). Solution: Use dict_get_bool(). (closes #6882)
1 parent 4b9bd69 commit 401f0c0

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/quickfix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7072,7 +7072,7 @@ qf_add_entry_from_dict(
70727072

70737073
// If the 'valid' field is present it overrules the detected value.
70747074
if ((dict_find(d, (char_u *)"valid", -1)) != NULL)
7075-
valid = (int)dict_get_number(d, (char_u *)"valid");
7075+
valid = (int)dict_get_bool(d, (char_u *)"valid", FALSE);
70767076

70777077
status = qf_add_entry(qfl,
70787078
NULL, // dir

src/testdir/test_vim9_func.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,13 @@ def Test_setbufvar()
16141614
assert_equal(123, getbufvar('%', 'myvar'))
16151615
enddef
16161616

1617+
def Test_setloclist()
1618+
let items = [#{filename: '/tmp/file', lnum: 1, valid: true}]
1619+
let what = #{items: items}
1620+
setqflist([], ' ', what)
1621+
setloclist(0, [], ' ', what)
1622+
enddef
1623+
16171624
def Test_setreg()
16181625
setreg('a', ['aaa', 'bbb', 'ccc'])
16191626
let reginfo = getreginfo('a')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1618,
757759
/**/
758760
1617,
759761
/**/

0 commit comments

Comments
 (0)