aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-25 17:37:06 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-07-25 18:20:47 +0800
commit2241fd3211012e5eba3479d64e190f206c12087e (patch)
treea51af38158d406d75c2154e821c1d479c6bf6987 /src/nvim/eval
parent3ea45a2caf23ac1c335d04c0a3b2b2aa254d3d96 (diff)
downloadrneovim-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')
-rw-r--r--src/nvim/eval/vars.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c
index edc112109a..091e3f87c4 100644
--- a/src/nvim/eval/vars.c
+++ b/src/nvim/eval/vars.c
@@ -620,7 +620,7 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
emsg(_(e_letunexp));
} else {
varnumber_T n = 0;
- int opt_type;
+ getoption_T opt_type;
long numval;
char *stringval = NULL;
const char *s = NULL;
@@ -630,7 +630,10 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
*p = NUL;
opt_type = get_option_value(arg, &numval, &stringval, opt_flags);
- if (opt_type == 1 || opt_type == -1) {
+ if (opt_type == gov_bool
+ || opt_type == gov_number
+ || opt_type == gov_hidden_bool
+ || opt_type == gov_hidden_number) {
// number, possibly hidden
n = (long)tv_get_number(tv);
}
@@ -641,12 +644,13 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
}
if (op != NULL && *op != '=') {
- if ((opt_type == 1 && *op == '.')
- || (opt_type == 0 && *op != '.')) {
+ if (((opt_type == gov_bool || opt_type == gov_number) && *op == '.')
+ || (opt_type == gov_string && *op != '.')) {
semsg(_(e_letwrong), op);
failed = true; // don't set the value
} else {
- if (opt_type == 1) { // number
+ // number or bool
+ if (opt_type == gov_number || opt_type == gov_bool) {
switch (*op) {
case '+':
n = numval + n; break;
@@ -659,7 +663,7 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
case '%':
n = num_modulus(numval, n); break;
}
- } else if (opt_type == 0 && stringval != NULL && s != NULL) {
+ } else if (opt_type == gov_string && stringval != NULL && s != NULL) {
// string
char *const oldstringval = stringval;
stringval = (char *)concat_str((const char_u *)stringval,
@@ -671,7 +675,7 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
}
if (!failed) {
- if (opt_type != 0 || s != NULL) {
+ if (opt_type != gov_string || s != NULL) {
set_option_value(arg, n, s, opt_flags);
arg_end = p;
} else {