diff options
| author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-12-10 16:26:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-10 16:26:08 +0100 |
| commit | 529498685bbcd4783bc0e816d6247118c9ffb9a7 (patch) | |
| tree | 4a907cfe9e6d7cd49d0dd3d60a70550b6598b391 /src/nvim/api/deprecated.c | |
| parent | c675e51c2f3f8bf46457a3f6653af06a2a946f69 (diff) | |
| parent | a34cc1a44de75eff4c6b43f983dc983eb283119d (diff) | |
| download | rneovim-529498685bbcd4783bc0e816d6247118c9ffb9a7.tar.gz rneovim-529498685bbcd4783bc0e816d6247118c9ffb9a7.tar.bz2 rneovim-529498685bbcd4783bc0e816d6247118c9ffb9a7.zip | |
Merge pull request #26458 from famiu/refactor/options/optionindex
Diffstat (limited to 'src/nvim/api/deprecated.c')
| -rw-r--r-- | src/nvim/api/deprecated.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index d6a76617a7..371361c5a1 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -643,7 +643,7 @@ static Object get_option_from(void *from, OptReqScope req_scope, String name, Er return (Object)OBJECT_INIT; }); - OptVal value = get_option_value_strict(name.data, req_scope, from, err); + OptVal value = get_option_value_strict(findoption(name.data), req_scope, from, err); if (ERROR_SET(err)) { return (Object)OBJECT_INIT; } @@ -669,8 +669,8 @@ static void set_option_to(uint64_t channel_id, void *to, OptReqScope req_scope, return; }); - int flags = get_option_attrs(name.data); - VALIDATE_S(flags != 0, "option name", name.data, { + OptIndex opt_idx = findoption(name.data); + VALIDATE_S(opt_idx != kOptInvalid, "option name", name.data, { return; }); @@ -685,13 +685,14 @@ static void set_option_to(uint64_t channel_id, void *to, OptReqScope req_scope, return; }); + int attrs = get_option_attrs(opt_idx); // For global-win-local options -> setlocal // For win-local options -> setglobal and setlocal (opt_flags == 0) - const int opt_flags = (req_scope == kOptReqWin && !(flags & SOPT_GLOBAL)) + const int opt_flags = (req_scope == kOptReqWin && !(attrs & SOPT_GLOBAL)) ? 0 : (req_scope == kOptReqGlobal) ? OPT_GLOBAL : OPT_LOCAL; WITH_SCRIPT_CONTEXT(channel_id, { - set_option_value_for(name.data, optval, opt_flags, req_scope, to, err); + set_option_value_for(name.data, opt_idx, optval, opt_flags, req_scope, to, err); }); } |