To: vim_dev@googlegroups.com Subject: Patch 8.2.1612 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1612 Problem: Vim9: cannot pass "true" to prop_remove(). Solution: Use dict_get_bool(). (closes #6853) Files: src/textprop.c, src/testdir/test_textprop.vim *** ../vim-8.2.1611/src/textprop.c 2020-09-03 22:33:40.969029618 +0200 --- src/textprop.c 2020-09-05 20:47:43.578133565 +0200 *************** *** 805,815 **** linenr_T lnum; dict_T *dict; buf_T *buf = curbuf; ! dictitem_T *di; ! int do_all = FALSE; int id = -1; int type_id = -1; ! int both = FALSE; rettv->vval.v_number = 0; if (argvars[0].v_type != VAR_DICT || argvars[0].vval.v_dict == NULL) --- 805,814 ---- linenr_T lnum; dict_T *dict; buf_T *buf = curbuf; ! int do_all; int id = -1; int type_id = -1; ! int both; rettv->vval.v_number = 0; if (argvars[0].v_type != VAR_DICT || argvars[0].vval.v_dict == NULL) *************** *** 837,845 **** if (buf->b_ml.ml_mfp == NULL) return; ! di = dict_find(dict, (char_u*)"all", -1); ! if (di != NULL) ! do_all = dict_get_number(dict, (char_u *)"all"); if (dict_find(dict, (char_u *)"id", -1) != NULL) id = dict_get_number(dict, (char_u *)"id"); --- 836,842 ---- if (buf->b_ml.ml_mfp == NULL) return; ! do_all = dict_get_bool(dict, (char_u *)"all", FALSE); if (dict_find(dict, (char_u *)"id", -1) != NULL) id = dict_get_number(dict, (char_u *)"id"); *************** *** 852,859 **** return; type_id = type->pt_id; } ! if (dict_find(dict, (char_u *)"both", -1) != NULL) ! both = dict_get_number(dict, (char_u *)"both"); if (id == -1 && type_id == -1) { emsg(_("E968: Need at least one of 'id' or 'type'")); --- 849,856 ---- return; type_id = type->pt_id; } ! both = dict_get_bool(dict, (char_u *)"both", FALSE); ! if (id == -1 && type_id == -1) { emsg(_("E968: Need at least one of 'id' or 'type'")); *** ../vim-8.2.1611/src/testdir/test_textprop.vim 2020-09-04 21:18:40.488161918 +0200 --- src/testdir/test_textprop.vim 2020-09-05 20:48:26.894034649 +0200 *************** *** 321,326 **** --- 321,335 ---- bwipe! endfunc + def Test_prop_remove_vim9() + new + call AddPropTypes() + call SetupPropsInFirstLine() + call assert_equal(1, prop_remove({'type': 'three', 'id': 13, 'both': true, 'all': true})) + call DeletePropTypes() + bwipe! + enddef + func SetupOneLine() call setline(1, 'xonex xtwoxx') normal gg0 *** ../vim-8.2.1611/src/version.c 2020-09-05 20:29:35.748679383 +0200 --- src/version.c 2020-09-05 20:39:01.667358657 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1612, /**/ -- The early bird gets the worm. If you want something else for breakfast, get up later. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///