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/api/options.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/api/options.c')
-rw-r--r-- | src/nvim/api/options.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/nvim/api/options.c b/src/nvim/api/options.c index 4ed676e613..5c9eba163b 100644 --- a/src/nvim/api/options.c +++ b/src/nvim/api/options.c @@ -104,20 +104,20 @@ Object nvim_get_option_value(String name, Dict(option) *opts, Error *err) long numval = 0; char *stringval = NULL; - int result = access_option_value_for(name.data, &numval, &stringval, scope, opt_type, from, - true, err); + getoption_T result = access_option_value_for(name.data, &numval, &stringval, scope, opt_type, + from, true, err); if (ERROR_SET(err)) { return rv; } switch (result) { - case 0: + case gov_string: rv = STRING_OBJ(cstr_as_string(stringval)); break; - case 1: + case gov_number: rv = INTEGER_OBJ(numval); break; - case 2: + case gov_bool: switch (numval) { case 0: case 1: @@ -483,8 +483,8 @@ void set_option_to(uint64_t channel_id, void *to, int type, String name, Object }); } -static int access_option_value(char *key, long *numval, char **stringval, int opt_flags, bool get, - Error *err) +static getoption_T access_option_value(char *key, long *numval, char **stringval, int opt_flags, + bool get, Error *err) { if (get) { return get_option_value(key, numval, stringval, opt_flags); @@ -501,13 +501,13 @@ static int access_option_value(char *key, long *numval, char **stringval, int op } } -static int access_option_value_for(char *key, long *numval, char **stringval, int opt_flags, - int opt_type, void *from, bool get, Error *err) +static getoption_T access_option_value_for(char *key, long *numval, char **stringval, int opt_flags, + int opt_type, void *from, bool get, Error *err) { bool need_switch = false; switchwin_T switchwin; aco_save_T aco; - int result = 0; + getoption_T result = 0; try_start(); switch (opt_type) { |