0
0
mirror of https://github.com/vim/vim.git synced 2025-08-25 19:53:53 -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;
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)
buf[utf_char2bytes((int)tv_get_number(&argvars[0]), buf)] = NUL;
else

View File

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

View File

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