mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
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)
dd1f426bd6
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user