neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 8921035fc762d39f42f1b644a19a78d36fbda87a
parent 2241fd3211012e5eba3479d64e190f206c12087e
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Mon, 25 Jul 2022 17:17:20 +0800

vim-patch:8.2.2284: Vim9: cannot set an option to a boolean value

Problem:    Vim9: cannot set an option to a boolean value.
Solution:   Check for VAR_BOOL. (closes vim/vim#7603)
https://github.com/vim/vim/commit/31a201a04aa95708af5d62070d2d397a201cc1a5

Diffstat:
Msrc/nvim/eval/vars.c | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c @@ -1564,10 +1564,17 @@ static void getwinvar(typval_T *argvars, typval_T *rettv, int off) /// Set option "varname" to the value of "varp" for the current buffer/window. static void set_option_from_tv(const char *varname, typval_T *varp) { + long numval = 0; + const char *strval; bool error = false; char nbuf[NUMBUFLEN]; - const long numval = (long)tv_get_number_chk(varp, &error); - const char *const strval = tv_get_string_buf_chk(varp, nbuf); + + if (varp->v_type == VAR_BOOL) { + numval = (long)varp->vval.v_number; + } else { + 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); }