From fb19aeeb33f76cd3b2fec9f62a22e01c212fb076 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Mon, 2 Sep 2019 04:38:50 +0200 Subject: API: make nvim_win_set_option() set window-global, not buffer-local #9110 NB: the `!(flags & SOPT_GLOBAL)` exception is for 'statusline'. Because `:set statusline=...` sets the global value for _all_ windows, `:setlocal` is the best we can do there. This is a one-of-a-kind option that doesn't work like any other option. --- test/functional/api/window_spec.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/functional/api/window_spec.lua') diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index 9af1bdb93b..3bc53cfc83 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -212,10 +212,18 @@ describe('API/win', function() it('works', function() curwin('set_option', 'colorcolumn', '4,3') eq('4,3', curwin('get_option', 'colorcolumn')) + command("set modified hidden") + command("enew") -- edit new buffer, window option is preserved + eq('4,3', curwin('get_option', 'colorcolumn')) + -- global-local option curwin('set_option', 'statusline', 'window-status') eq('window-status', curwin('get_option', 'statusline')) eq('', nvim('get_option', 'statusline')) + command("set modified") + command("enew") -- global-local: not preserved in new buffer + eq({false, "Failed to get value for option 'statusline'"}, meth_pcall(curwin, 'get_option', 'statusline')) + eq('', eval('&l:statusline')) -- confirm local value was not copied end) end) -- cgit