From 0e59f6f4c7cd376926fc5027b42a94e12cb017fe Mon Sep 17 00:00:00 2001 From: glepnir Date: Wed, 19 Mar 2025 20:16:20 +0800 Subject: fix(api): don't use 'winborder' when reconfiguring float (#32984) Problem: Reconfiguring a float window applies the global 'winborder'. Solution: - Ignore 'winborder' when reconfiguring a float window. - Still apply 'winborder' when converting a split to a float window. --- test/functional/api/window_spec.lua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 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 119c185b72..34b3b2dbe0 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -1907,6 +1907,38 @@ describe('API/win', function() end) describe('set_config', function() + it("uses 'winborder' when converting a split to a floating window", function() + api.nvim_set_option_value('winborder', 'single', {}) + command('split') + local winid = api.nvim_get_current_win() + -- Convert split to float without specifying border + api.nvim_win_set_config(winid, { + relative = 'editor', + row = 2, + col = 2, + width = 10, + height = 5, + }) + local config = api.nvim_win_get_config(winid) + eq('┌', config.border[1]) + end) + + it('erases border of a floating window when converting to split window', function() + api.nvim_set_option_value('winborder', 'single', {}) + local winid = api.nvim_open_win(api.nvim_create_buf(false, false), false, { + relative = 'editor', + row = 2, + col = 2, + width = 10, + height = 5, + }) + local config = api.nvim_win_get_config(winid) + eq('┌', config.border[1]) + api.nvim_win_set_config(winid, { split = 'right', win = 0 }) + config = api.nvim_win_get_config(winid) + eq(nil, config.border) + end) + it('moves a split into a float', function() local win = api.nvim_open_win(0, true, { vertical = false, -- cgit