Skip to content

Commit ed6a430

Browse files
committed
patch 8.2.1611: Vim9: cannot pass "true" to nr2char()
Problem: Vim9: cannot pass "true" to nr2char(). Solution: use tv_get_bool_chk(). (closes #6878)
1 parent a48f786 commit ed6a430

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/evalfunc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5874,7 +5874,7 @@ f_nr2char(typval_T *argvars, typval_T *rettv)
58745874
int utf8 = 0;
58755875

58765876
if (argvars[1].v_type != VAR_UNKNOWN)
5877-
utf8 = (int)tv_get_number_chk(&argvars[1], NULL);
5877+
utf8 = (int)tv_get_bool_chk(&argvars[1], NULL);
58785878
if (utf8)
58795879
buf[utf_char2bytes((int)tv_get_number(&argvars[0]), buf)] = NUL;
58805880
else

src/testdir/test_vim9_func.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,6 +1529,10 @@ def Test_list2str_str2list_utf8()
15291529
assert_equal(s, list2str(l, true))
15301530
enddef
15311531

1532+
def Test_nr2char()
1533+
assert_equal('a', nr2char(97, true))
1534+
enddef
1535+
15321536
def Fibonacci(n: number): number
15331537
if n < 2
15341538
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+
1611,
757759
/**/
758760
1610,
759761
/**/

0 commit comments

Comments
 (0)