diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-10-22 11:34:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-22 11:34:09 +0800 |
commit | 1b9dafa67ba98e360444832e1fddce1e96acc1d6 (patch) | |
tree | b5466c491cdc91a73904fc870ae69c9fb637552f /src | |
parent | f663243e95f488b8f4224bdae2697ddac21d0ffb (diff) | |
download | rneovim-1b9dafa67ba98e360444832e1fddce1e96acc1d6.tar.gz rneovim-1b9dafa67ba98e360444832e1fddce1e96acc1d6.tar.bz2 rneovim-1b9dafa67ba98e360444832e1fddce1e96acc1d6.zip |
fix(options): fix :setglobal not working for 'spelloptions' (#30894)
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/option.c | 1 | ||||
-rw-r--r-- | src/nvim/optionstr.c | 13 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 0aa9cf4d93..2e6d317778 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -5325,6 +5325,7 @@ void buf_copy_options(buf_T *buf, int flags) COPY_OPT_SCTX(buf, BV_SPL); buf->b_s.b_p_spo = xstrdup(p_spo); COPY_OPT_SCTX(buf, BV_SPO); + buf->b_s.b_p_spo_flags = spo_flags; buf->b_p_inde = xstrdup(p_inde); COPY_OPT_SCTX(buf, BV_INDE); buf->b_p_indk = xstrdup(p_indk); diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c index 8e488d2539..b560275de7 100644 --- a/src/nvim/optionstr.c +++ b/src/nvim/optionstr.c @@ -2116,7 +2116,7 @@ const char *did_set_spellfile(optset_T *args) // When there is a window for this buffer in which 'spell' // is set load the wordlists. - if ((!valid_spellfile(*varp))) { + if (!valid_spellfile(*varp)) { return e_invarg; } return did_set_spell_option(); @@ -2139,8 +2139,15 @@ const char *did_set_spelllang(optset_T *args) const char *did_set_spelloptions(optset_T *args) { win_T *win = (win_T *)args->os_win; - if (opt_strings_flags(win->w_s->b_p_spo, p_spo_values, &(win->w_s->b_p_spo_flags), - true) != OK) { + int opt_flags = args->os_flags; + const char *val = args->os_newval.string.data; + + if (!(opt_flags & OPT_LOCAL) + && opt_strings_flags(val, p_spo_values, &spo_flags, true) != OK) { + return e_invarg; + } + if (!(opt_flags & OPT_GLOBAL) + && opt_strings_flags(val, p_spo_values, &win->w_s->b_p_spo_flags, true) != OK) { return e_invarg; } return NULL; |