diff --git a/src/nvim/window.c b/src/nvim/window.c index f3b88f7a0b..6179c33b65 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -1364,6 +1364,7 @@ win_T *win_split_ins(int size, int flags, win_T *new_wp, int dir, frame_T *to_fl // make the contents of the new window the same as the current one win_init(wp, curwin, flags); } else if (wp->w_floating) { + WinStyle saved_style = wp->w_config.style; ui_comp_remove_grid(&wp->w_grid_alloc); if (ui_has(kUIMultigrid)) { wp->w_pos_changed = true; @@ -1388,6 +1389,8 @@ win_T *win_split_ins(int size, int flags, win_T *new_wp, int dir, frame_T *to_fl // non-floating window doesn't store float config or have a border. merge_win_config(&wp->w_config, WIN_CONFIG_INIT); CLEAR_FIELD(wp->w_border_adj); + // Restore WinConfig style. #37067 + wp->w_config.style = saved_style; } // Going to reorganize frames now, make sure they're flat. diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index bb18143749..6887284caf 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -3478,5 +3478,34 @@ describe('API/win', function() pcall_err(api.nvim_win_set_config, old_curwin, { win = other_tp_win, split = 'right' }) ) end) + + it('minimal style persists through float-to-split and buffer change #37067', function() + -- Set all options globally + command('set number relativenumber cursorline cursorcolumn spell list') + command('set signcolumn=yes colorcolumn=80 statuscolumn=%l foldcolumn=2') + local buf1 = api.nvim_create_buf(false, true) + local win = api.nvim_open_win(buf1, true, { + relative = 'editor', + width = 10, + height = 10, + row = 5, + col = 5, + style = 'minimal', + }) + -- Convert to split then change buffer + api.nvim_win_set_config(win, { split = 'below', win = -1 }) + local buf2 = api.nvim_create_buf(false, true) + api.nvim_win_set_buf(win, buf2) + eq(false, api.nvim_get_option_value('number', { win = win })) + eq(false, api.nvim_get_option_value('relativenumber', { win = win })) + eq(false, api.nvim_get_option_value('cursorline', { win = win })) + eq(false, api.nvim_get_option_value('cursorcolumn', { win = win })) + eq(false, api.nvim_get_option_value('spell', { win = win })) + eq(false, api.nvim_get_option_value('list', { win = win })) + eq('0', api.nvim_get_option_value('foldcolumn', { win = win })) + eq('auto', api.nvim_get_option_value('signcolumn', { win = win })) + eq('', api.nvim_get_option_value('colorcolumn', { win = win })) + eq('', api.nvim_get_option_value('statuscolumn', { win = win })) + end) end) end)