aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/options.c
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2025-01-08 17:56:21 +0000
committerGitHub <noreply@github.com>2025-01-08 17:56:21 +0000
commitc4b658fed8d96a4c4098ce59b01b228ef0bda62e (patch)
tree50f10b101e425a04c646d5970eed88a4318f2069 /src/nvim/api/options.c
parent17b46d01e29443452ae8b607017f8f5c585d3f0a (diff)
parent6257270040bc5c61a489f7fb9d4102223c36cf89 (diff)
downloadrneovim-c4b658fed8d96a4c4098ce59b01b228ef0bda62e.tar.gz
rneovim-c4b658fed8d96a4c4098ce59b01b228ef0bda62e.tar.bz2
rneovim-c4b658fed8d96a4c4098ce59b01b228ef0bda62e.zip
Merge pull request #31112 from famiu/refactor/options/set_option_for
refactor(options): set option value for non-current context directly
Diffstat (limited to 'src/nvim/api/options.c')
-rw-r--r--src/nvim/api/options.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nvim/api/options.c b/src/nvim/api/options.c
index 64f8a35d54..2bbbdbbe8c 100644
--- a/src/nvim/api/options.c
+++ b/src/nvim/api/options.c
@@ -157,8 +157,8 @@ Object nvim_get_option_value(String name, Dict(option) *opts, Error *err)
void *from = NULL;
char *filetype = NULL;
- if (!validate_option_value_args(opts, name.data, &opt_idx, &opt_flags, &scope, &from,
- &filetype, err)) {
+ if (!validate_option_value_args(opts, name.data, &opt_idx, &opt_flags, &scope, &from, &filetype,
+ err)) {
return (Object)OBJECT_INIT;
}
@@ -182,7 +182,7 @@ Object nvim_get_option_value(String name, Dict(option) *opts, Error *err)
from = ftbuf;
}
- OptVal value = get_option_value_for(opt_idx, opt_flags, scope, from, err);
+ OptVal value = get_option_value_from(opt_idx, option_ctx_from(scope, from), opt_flags);
if (ftbuf != NULL) {
// restore curwin/curbuf and a few other things
@@ -257,7 +257,11 @@ void nvim_set_option_value(uint64_t channel_id, String name, Object value, Dict(
});
WITH_SCRIPT_CONTEXT(channel_id, {
- set_option_value_for(name.data, opt_idx, optval, opt_flags, scope, to, err);
+ const char *errmsg
+ = set_option_value_for(opt_idx, optval, option_ctx_from(scope, to), opt_flags);
+ if (errmsg) {
+ api_set_error(err, kErrorTypeException, "%s", errmsg);
+ }
});
}