mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
fix(options): fix :setglobal not working for 'spelloptions' (#30894)
This commit is contained in:
parent
f663243e95
commit
1b9dafa67b
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -408,4 +408,52 @@ describe("'spell'", function()
|
||||
{5:-- VISUAL LINE --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
it("global value works properly for 'spelloptions'", function()
|
||||
screen:try_resize(43, 3)
|
||||
exec('set spell')
|
||||
-- :setglobal applies to future buffers but not current buffer
|
||||
exec('setglobal spelloptions=camel')
|
||||
insert('Here is TheCamelWord being spellchecked')
|
||||
screen:expect([[
|
||||
Here is {1:TheCamelWord} being spellchecke^d |
|
||||
{0:~ }|
|
||||
|
|
||||
]])
|
||||
exec('enew')
|
||||
insert('There is TheCamelWord being spellchecked')
|
||||
screen:expect([[
|
||||
There is TheCamelWord being spellchecke^d |
|
||||
{0:~ }|
|
||||
|
|
||||
]])
|
||||
-- :setlocal applies to current buffer but not future buffers
|
||||
exec('setlocal spelloptions=')
|
||||
screen:expect([[
|
||||
There is {1:TheCamelWord} being spellchecke^d |
|
||||
{0:~ }|
|
||||
|
|
||||
]])
|
||||
exec('enew')
|
||||
insert('What is TheCamelWord being spellchecked')
|
||||
screen:expect([[
|
||||
What is TheCamelWord being spellchecke^d |
|
||||
{0:~ }|
|
||||
|
|
||||
]])
|
||||
-- :set applies to both current buffer and future buffers
|
||||
exec('set spelloptions=')
|
||||
screen:expect([[
|
||||
What is {1:TheCamelWord} being spellchecke^d |
|
||||
{0:~ }|
|
||||
|
|
||||
]])
|
||||
exec('enew')
|
||||
insert('Where is TheCamelWord being spellchecked')
|
||||
screen:expect([[
|
||||
Where is {1:TheCamelWord} being spellchecke^d |
|
||||
{0:~ }|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
@ -56,7 +56,6 @@ let skip_setglobal_reasons = #{
|
||||
\ shiftwidth: 'TODO: fix missing error handling for setglobal',
|
||||
\ sidescrolloff: 'TODO: fix missing error handling for setglobal',
|
||||
\ signcolumn: 'TODO(nvim): fix missing error handling for setglobal',
|
||||
\ spelloptions: 'TODO(nvim): fix missing error handling for setglobal',
|
||||
\ tabstop: 'TODO: fix missing error handling for setglobal',
|
||||
\ termwinkey: 'TODO: fix missing error handling for setglobal',
|
||||
\ termwinsize: 'TODO: fix missing error handling for setglobal',
|
||||
|
Loading…
Reference in New Issue
Block a user