Skip to content

Commit fa2e38d

Browse files
committed
patch 8.2.1613: Vim9: cannot pass "true" to prop_type_add()
Problem: Vim9: cannot pass "true" to prop_type_add(). Solution: Use tv_get_bool(). (closes #6850)
1 parent a5a40c5 commit fa2e38d

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

src/testdir/test_textprop.vim

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,17 @@ func Test_prop_remove()
321321
bwipe!
322322
endfunc
323323

324+
def Test_prop_add_vim9()
325+
prop_type_add('comment', #{
326+
highlight: 'Directory',
327+
priority: 123,
328+
start_incl: true,
329+
end_incl: true,
330+
combine: false,
331+
})
332+
prop_type_delete('comment')
333+
enddef
334+
324335
def Test_prop_remove_vim9()
325336
new
326337
call AddPropTypes()

src/textprop.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ prop_type_set(typval_T *argvars, int add)
10071007
di = dict_find(dict, (char_u *)"combine", -1);
10081008
if (di != NULL)
10091009
{
1010-
if (tv_get_number(&di->di_tv))
1010+
if (tv_get_bool(&di->di_tv))
10111011
prop->pt_flags |= PT_FLAG_COMBINE;
10121012
else
10131013
prop->pt_flags &= ~PT_FLAG_COMBINE;
@@ -1020,7 +1020,7 @@ prop_type_set(typval_T *argvars, int add)
10201020
di = dict_find(dict, (char_u *)"start_incl", -1);
10211021
if (di != NULL)
10221022
{
1023-
if (tv_get_number(&di->di_tv))
1023+
if (tv_get_bool(&di->di_tv))
10241024
prop->pt_flags |= PT_FLAG_INS_START_INCL;
10251025
else
10261026
prop->pt_flags &= ~PT_FLAG_INS_START_INCL;
@@ -1029,7 +1029,7 @@ prop_type_set(typval_T *argvars, int add)
10291029
di = dict_find(dict, (char_u *)"end_incl", -1);
10301030
if (di != NULL)
10311031
{
1032-
if (tv_get_number(&di->di_tv))
1032+
if (tv_get_bool(&di->di_tv))
10331033
prop->pt_flags |= PT_FLAG_INS_END_INCL;
10341034
else
10351035
prop->pt_flags &= ~PT_FLAG_INS_END_INCL;

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+
1613,
757759
/**/
758760
1612,
759761
/**/

0 commit comments

Comments
 (0)