Skip to content

Commit fcb6d70

Browse files
committed
patch 8.2.1616: Vim9: cannot pass "true" to synID()
Problem: Vim9: cannot pass "true" to synID(). Solution: Use tv_get_bool_chk(). (closes #6860)
1 parent 30788d3 commit fcb6d70

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/evalfunc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8487,7 +8487,7 @@ f_synID(typval_T *argvars UNUSED, typval_T *rettv)
84878487

84888488
lnum = tv_get_lnum(argvars); // -1 on type error
84898489
col = (linenr_T)tv_get_number(&argvars[1]) - 1; // -1 on type error
8490-
trans = (int)tv_get_number_chk(&argvars[2], &transerr);
8490+
trans = (int)tv_get_bool_chk(&argvars[2], &transerr);
84918491

84928492
if (!transerr && lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
84938493
&& col >= 0 && col < (long)STRLEN(ml_get(lnum)))

src/testdir/test_vim9_func.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,6 +1551,13 @@ def Test_searchdecl()
15511551
assert_equal(1, searchdecl('blah', true, true))
15521552
enddef
15531553

1554+
def Test_synID()
1555+
new
1556+
setline(1, "text")
1557+
assert_equal(0, synID(1, 1, true))
1558+
bwipe!
1559+
enddef
1560+
15541561
def Fibonacci(n: number): number
15551562
if n < 2
15561563
return n

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+
1616,
757759
/**/
758760
1615,
759761
/**/

0 commit comments

Comments
 (0)