To: vim_dev@googlegroups.com Subject: Patch 8.2.2285 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2285 Problem: Vim9: cannot set an option to a false. Solution: For VAR_BOOL use string "0". (closes #7603) Files: src/evalvars.c, src/testdir/test_vim9_builtin.vim *** ../vim-8.2.2284/src/evalvars.c 2021-01-03 14:47:19.555379369 +0100 --- src/evalvars.c 2021-01-03 15:53:55.856909927 +0100 *************** *** 3509,3518 **** int error = FALSE; if (varp->v_type == VAR_BOOL) numval = (long)varp->vval.v_number; ! else if (!in_vim9script() || varp->v_type != VAR_STRING) ! numval = (long)tv_get_number_chk(varp, &error); ! strval = tv_get_string_buf_chk(varp, nbuf); if (!error && strval != NULL) set_option_value(varname, numval, strval, OPT_LOCAL); } --- 3509,3524 ---- int error = FALSE; if (varp->v_type == VAR_BOOL) + { numval = (long)varp->vval.v_number; ! strval = (char_u *)"0"; // avoid using "false" ! } ! else ! { ! if (!in_vim9script() || varp->v_type != VAR_STRING) ! numval = (long)tv_get_number_chk(varp, &error); ! strval = tv_get_string_buf_chk(varp, nbuf); ! } if (!error && strval != NULL) set_option_value(varname, numval, strval, OPT_LOCAL); } *** ../vim-8.2.2284/src/testdir/test_vim9_builtin.vim 2021-01-03 14:47:19.555379369 +0100 --- src/testdir/test_vim9_builtin.vim 2021-01-03 15:53:20.301055930 +0100 *************** *** 662,667 **** --- 662,669 ---- settabwinvar(1, 1, '&ts', 15) &ts->assert_equal(15) setlocal ts=8 + settabwinvar(1, 1, '&list', false) + &list->assert_equal(false) settabwinvar(1, 1, '&list', true) &list->assert_equal(true) setlocal list& *** ../vim-8.2.2284/src/version.c 2021-01-03 14:47:19.555379369 +0100 --- src/version.c 2021-01-03 15:54:50.388687856 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2285, /**/ -- From "know your smileys": :-{} Too much lipstick /// 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 ///