mirror of
https://github.com/neovim/neovim.git
synced 2026-03-28 03:12:00 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user