diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-25 17:17:20 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-25 18:20:47 +0800 |
commit | 8921035fc762d39f42f1b644a19a78d36fbda87a (patch) | |
tree | b6282ac846d56ee8811971dee011bf68b133a245 | |
parent | 2241fd3211012e5eba3479d64e190f206c12087e (diff) | |
download | rneovim-8921035fc762d39f42f1b644a19a78d36fbda87a.tar.gz rneovim-8921035fc762d39f42f1b644a19a78d36fbda87a.tar.bz2 rneovim-8921035fc762d39f42f1b644a19a78d36fbda87a.zip |
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
-rw-r--r-- | src/nvim/eval/vars.c | 11 |
1 files changed, 9 insertions, 2 deletions
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); } |