neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 2d3dc070ce6b0db28bc7c7ae36541ef518fdeb08
parent df2323da70facc4337386e25b04c23baf97f6ece
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Sat, 10 Jan 2026 22:28:45 +0800

fix(session): window sizes not stored with float windows (#37344)


Diffstat:
Msrc/nvim/ex_session.c | 2+-
Mtest/functional/ex_cmds/mksession_spec.lua | 13+++++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c @@ -783,7 +783,7 @@ static int makeopens(FILE *fd, char *dirnow) for (win_T *wp = tab_firstwin; wp != NULL; wp = wp->w_next) { if (ses_do_win(wp)) { nr++; - } else { + } else if (!wp->w_floating) { restore_size = false; } if (curwin == wp) { diff --git a/test/functional/ex_cmds/mksession_spec.lua b/test/functional/ex_cmds/mksession_spec.lua @@ -232,6 +232,11 @@ describe(':mksession', function() local tmpfile = file_prefix .. '-tmpfile-float' command('edit ' .. tmpfile) + eq(80, fn.winwidth(1)) + command('30vsplit') + eq(2, #api.nvim_list_wins()) + eq(30, fn.winwidth(1)) + eq(49, fn.winwidth(2)) local buf = api.nvim_create_buf(false, true) local config = { relative = 'editor', @@ -243,6 +248,7 @@ describe(':mksession', function() style = 'minimal', } api.nvim_open_win(buf, false, config) + eq(3, #api.nvim_list_wins()) local cmdheight = api.nvim_get_option_value('cmdheight', {}) command('mksession ' .. session_file) @@ -252,9 +258,12 @@ describe(':mksession', function() command('source ' .. session_file) eq(tmpfile, fn.expand('%')) - -- Check that there is only a single window, which indicates the floating + -- Check that there are only two windows, which indicates the floating -- window was not restored. - eq(1, fn.winnr('$')) + -- Don't use winnr('$') as that doesn't count unfocusable floating windows. + eq(2, #api.nvim_list_wins()) + eq(30, fn.winwidth(1)) + eq(49, fn.winwidth(2)) -- The command-line height should remain the same as it was. eq(cmdheight, api.nvim_get_option_value('cmdheight', {}))