0
0
mirror of https://github.com/vim/vim.git synced 2025-08-26 20:03:41 -04:00

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)
This commit is contained in:
Bram Moolenaar 2020-09-05 20:29:41 +02:00
parent a48f786787
commit ed6a430fae
3 changed files with 7 additions and 1 deletions

View File

@ -5874,7 +5874,7 @@ f_nr2char(typval_T *argvars, typval_T *rettv)
int utf8 = 0; int utf8 = 0;
if (argvars[1].v_type != VAR_UNKNOWN) if (argvars[1].v_type != VAR_UNKNOWN)
utf8 = (int)tv_get_number_chk(&argvars[1], NULL); utf8 = (int)tv_get_bool_chk(&argvars[1], NULL);
if (utf8) if (utf8)
buf[utf_char2bytes((int)tv_get_number(&argvars[0]), buf)] = NUL; buf[utf_char2bytes((int)tv_get_number(&argvars[0]), buf)] = NUL;
else else

View File

@ -1529,6 +1529,10 @@ def Test_list2str_str2list_utf8()
assert_equal(s, list2str(l, true)) assert_equal(s, list2str(l, true))
enddef enddef
def Test_nr2char()
assert_equal('a', nr2char(97, true))
enddef
def Fibonacci(n: number): number def Fibonacci(n: number): number
if n < 2 if n < 2
return n return n

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 */
/**/
1611,
/**/ /**/
1610, 1610,
/**/ /**/