From 8921035fc762d39f42f1b644a19a78d36fbda87a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 25 Jul 2022 17:17:20 +0800 Subject: 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 --- src/nvim/eval/vars.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c index 091e3f87c4..40a3707060 100644 --- 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); } -- cgit