0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.1592: Vim9: passing "true" to char2nr() fails

Problem:    Vim9: passing "true" to char2nr() fails.
Solution:   Use tv_get_bool_chk(). (closes #6865)
This commit is contained in:
Bram Moolenaar
2020-09-04 19:50:57 +02:00
parent c05d1c043a
commit 24f7750ffa
3 changed files with 7 additions and 1 deletions

View File

@@ -1710,7 +1710,7 @@ f_char2nr(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)
rettv->vval.v_number = utf_ptr2char(tv_get_string(&argvars[0]));

View File

@@ -1339,6 +1339,10 @@ def Test_col()
assert_equal(5, col([1, '$']))
enddef
def Test_char2nr()
assert_equal(12354, char2nr('あ', true))
enddef
def Test_getreg_return_type()
let s1: string = getreg('"')
let s2: string = getreg('"', 1)

View File

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