fix(api): style=minimal not applied immediately for unmoved split

Problem: nvim_win_set_config with style="minimal" does not take immediate effect
when a split is not moved.

Solution: don't skip nvim_win_set_config's epilogue when only a resize may be
needed. De-duplicate resize logic and remove unnecessary redraw. (win_set*_win
already handles that)
This commit is contained in:
Sean Dewar
2026-03-04 09:01:05 +00:00
parent 72d3a57f27
commit f5d03ec930
2 changed files with 8 additions and 8 deletions

View File

@@ -475,14 +475,7 @@ void nvim_win_set_config(Window window, Dict(win_config) *config, Error *err)
// then we can just change the size of the window.
if ((!has_vertical && !has_split)
|| (was_split && !HAS_KEY_X(config, win) && old_split == fconfig.split)) {
if (HAS_KEY_X(config, width)) {
win_setwidth_win(fconfig.width, win);
}
if (HAS_KEY_X(config, height)) {
win_setheight_win(fconfig.height, win);
}
redraw_later(win, UPD_NOT_VALID);
return;
goto resize_split;
}
if (!check_split_disallowed_err(win, err)) {
@@ -643,6 +636,7 @@ restore_curwin:
win_tp->tp_curwin = altwin;
}
resize_split:
if (HAS_KEY_X(config, width)) {
win_setwidth_win(fconfig.width, win);
}

View File

@@ -2495,6 +2495,12 @@ describe('API/win', function()
"non-float with 'win' requires at least 'split' or 'vertical'",
pcall_err(api.nvim_win_set_config, 0, { win = 0, relative = '' })
)
-- "minimal" style takes effect immediately for a split.
api.nvim_set_option_value('cursorline', true, { win = win, scope = 'local' })
eq(true, api.nvim_get_option_value('cursorline', { win = win }))
api.nvim_win_set_config(win, { style = 'minimal' })
eq(false, api.nvim_get_option_value('cursorline', { win = win }))
end)
it('creates top-level splits', function()