Mercurial > vim
diff src/evalvars.c @ 23485:198ad7ef2420 v8.2.2285
patch 8.2.2285: Vim9: cannot set an option to a false
Commit: https://github.com/vim/vim/commit/b0d8182fa39f2c9403f5f9a0663589fcab43a6c8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 3 15:55:10 2021 +0100
patch 8.2.2285: Vim9: cannot set an option to a false
Problem: Vim9: cannot set an option to a false.
Solution: For VAR_BOOL use string "0". (closes https://github.com/vim/vim/issues/7603)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 03 Jan 2021 16:00:03 +0100 |
parents | ce7d6b461660 |
children | 2247a2ce3630 |
line wrap: on
line diff
--- a/src/evalvars.c +++ b/src/evalvars.c @@ -3509,10 +3509,16 @@ set_option_from_tv(char_u *varname, typv 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); + 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); }