aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Dewar <6256228+seandewar@users.noreply.github.com>2024-03-09 01:00:33 +0000
committerSean Dewar <6256228+seandewar@users.noreply.github.com>2024-03-09 01:00:33 +0000
commit54022a2946aca5de991e7fa1ebc2954340ec20a8 (patch)
tree295a81edf26f8f89899106995fde3681910555cb
parente7c262f5553c1c6e1de95bcbdc8cfe7cc9d5e55e (diff)
downloadrneovim-54022a2946aca5de991e7fa1ebc2954340ec20a8.tar.gz
rneovim-54022a2946aca5de991e7fa1ebc2954340ec20a8.tar.bz2
rneovim-54022a2946aca5de991e7fa1ebc2954340ec20a8.zip
fix(api): win_set_config update statuslines after removing splits
Problem: nvim_win_set_config does not update statuslines after removing a split. Solution: call last_status. Didn't realize this was missing in the original nvim_win_set_config for splits PR. As it can only be done for the current tabpage, do it if win_tp == curtab; enter_tabpage will eventually call last_status anyway when the user enters another tabpage.
-rw-r--r--src/nvim/api/win_config.c4
-rw-r--r--test/functional/api/window_spec.lua22
2 files changed, 26 insertions, 0 deletions
diff --git a/src/nvim/api/win_config.c b/src/nvim/api/win_config.c
index dab1e4e80b..32b2156313 100644
--- a/src/nvim/api/win_config.c
+++ b/src/nvim/api/win_config.c
@@ -550,6 +550,10 @@ void nvim_win_set_config(Window window, Dict(win_config) *config, Error *err)
}
}
win_remove(win, win_tp == curtab ? NULL : win_tp);
+ if (win_tp == curtab) {
+ last_status(false); // may need to remove last status line
+ win_comp_pos(); // recompute window positions
+ }
int flags = win_split_flags(fconfig.split, parent == NULL) | WSP_NOENTER;
TRY_WRAP(err, {
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index ae8a519f11..6b7c550ca8 100644
--- a/test/functional/api/window_spec.lua
+++ b/test/functional/api/window_spec.lua
@@ -2379,6 +2379,28 @@ describe('API/win', function()
)
eq(cur_win, api.nvim_get_current_win())
end)
+
+ it('updates statusline when moving bottom split', function()
+ local screen = Screen.new(10, 10)
+ screen:set_default_attr_ids({
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { bold = true, reverse = true }, -- StatusLine
+ })
+ screen:attach()
+ exec([[
+ set laststatus=0
+ belowright split
+ call nvim_win_set_config(0, #{split: 'above', win: win_getid(winnr('#'))})
+ ]])
+ screen:expect([[
+ ^ |
+ {0:~ }|*3
+ {1:[No Name] }|
+ |
+ {0:~ }|*3
+ |
+ ]])
+ end)
end)
describe('get_config', function()