mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 22:38:16 +00:00
options: setlocal should only set local value
For 'iminsert' and 'imsearch' the global value was always changed.
This commit is contained in:
@@ -4120,7 +4120,6 @@ static char *set_num_option(int opt_idx, char_u *varp, long value,
|
|||||||
errmsg = e_invarg;
|
errmsg = e_invarg;
|
||||||
curbuf->b_p_iminsert = B_IMODE_NONE;
|
curbuf->b_p_iminsert = B_IMODE_NONE;
|
||||||
}
|
}
|
||||||
p_iminsert = curbuf->b_p_iminsert;
|
|
||||||
showmode();
|
showmode();
|
||||||
/* Show/unshow value of 'keymap' in status lines. */
|
/* Show/unshow value of 'keymap' in status lines. */
|
||||||
status_redraw_curbuf();
|
status_redraw_curbuf();
|
||||||
@@ -4134,7 +4133,6 @@ static char *set_num_option(int opt_idx, char_u *varp, long value,
|
|||||||
errmsg = e_invarg;
|
errmsg = e_invarg;
|
||||||
curbuf->b_p_imsearch = B_IMODE_NONE;
|
curbuf->b_p_imsearch = B_IMODE_NONE;
|
||||||
}
|
}
|
||||||
p_imsearch = curbuf->b_p_imsearch;
|
|
||||||
}
|
}
|
||||||
/* if 'titlelen' has changed, redraw the title */
|
/* if 'titlelen' has changed, redraw the title */
|
||||||
else if (pp == &p_titlelen) {
|
else if (pp == &p_titlelen) {
|
||||||
|
22
test/functional/options/setlocal_setglobal_spec.lua
Normal file
22
test/functional/options/setlocal_setglobal_spec.lua
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
-- Tests for :setlocal and :setglobal
|
||||||
|
|
||||||
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
local clear, execute, eval, eq, nvim =
|
||||||
|
helpers.clear, helpers.execute, helpers.eval, helpers.eq, helpers.nvim
|
||||||
|
|
||||||
|
local function get_num_option_global(opt)
|
||||||
|
return nvim('command_output', 'setglobal ' .. opt .. '?'):match('%d+')
|
||||||
|
end
|
||||||
|
|
||||||
|
describe(':setlocal', function()
|
||||||
|
before_each(clear)
|
||||||
|
|
||||||
|
it('setlocal sets only local value', function()
|
||||||
|
eq('0', get_num_option_global('iminsert'))
|
||||||
|
execute('setlocal iminsert=1')
|
||||||
|
eq('0', get_num_option_global('iminsert'))
|
||||||
|
eq('0', get_num_option_global('imsearch'))
|
||||||
|
execute('setlocal imsearch=1')
|
||||||
|
eq('0', get_num_option_global('imsearch'))
|
||||||
|
end)
|
||||||
|
end)
|
Reference in New Issue
Block a user