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 -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202101031456.103EufNd2149148%40masaka.moolenaar.net.

Raspunde prin e-mail lui