diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-25 17:37:06 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-25 18:20:47 +0800 |
commit | 2241fd3211012e5eba3479d64e190f206c12087e (patch) | |
tree | a51af38158d406d75c2154e821c1d479c6bf6987 /src/nvim/eval.c | |
parent | 3ea45a2caf23ac1c335d04c0a3b2b2aa254d3d96 (diff) | |
download | rneovim-2241fd3211012e5eba3479d64e190f206c12087e.tar.gz rneovim-2241fd3211012e5eba3479d64e190f206c12087e.tar.bz2 rneovim-2241fd3211012e5eba3479d64e190f206c12087e.zip |
vim-patch:8.2.2254: Vim9: bool option type is number
Problem: Vim9: bool option type is number.
Solution: Have get_option_value() return a different value for bool and
number options. (closes vim/vim#7583)
https://github.com/vim/vim/commit/dd1f426bd617ac6a775f2e7795ff0b159e3fa315
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 7b2a20e6fb..9c27ec16f3 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -3774,7 +3774,7 @@ int get_option_tv(const char **const arg, typval_T *const rettv, const bool eval { long numval; char *stringval; - int opt_type; + getoption_T opt_type; bool working = (**arg == '+'); // has("+option") int ret = OK; int opt_flags; @@ -3798,26 +3798,28 @@ int get_option_tv(const char **const arg, typval_T *const rettv, const bool eval opt_type = get_option_value(*arg, &numval, rettv == NULL ? NULL : &stringval, opt_flags); - if (opt_type == -3) { // invalid name + if (opt_type == gov_unknown) { if (rettv != NULL) { semsg(_("E113: Unknown option: %s"), *arg); } ret = FAIL; } else if (rettv != NULL) { - if (opt_type == -2) { // hidden string option + if (opt_type == gov_hidden_string) { rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - } else if (opt_type == -1) { // hidden number option + } else if (opt_type == gov_hidden_bool || opt_type == gov_hidden_number) { rettv->v_type = VAR_NUMBER; rettv->vval.v_number = 0; - } else if (opt_type == 1 || opt_type == 2) { // number or boolean option + } else if (opt_type == gov_bool || opt_type == gov_number) { rettv->v_type = VAR_NUMBER; rettv->vval.v_number = numval; } else { // string option rettv->v_type = VAR_STRING; rettv->vval.v_string = stringval; } - } else if (working && (opt_type == -2 || opt_type == -1)) { + } else if (working && (opt_type == gov_hidden_bool + || opt_type == gov_hidden_number + || opt_type == gov_hidden_string)) { ret = FAIL; } |