fix(float): don't unload 'hidden' float buffer with :close! (#39304)

Problem:  When closing floating windows to close a tabpage, if the current
          buffer will unload, buffers contained in those floating windows
          will too (unexpectedly).
Solution: Don't pass along "free_buf" argument; check 'bufhidden' for
          the buffer in the to be closed float.
(cherry picked from commit 5b0ad4a060)

Co-authored-by: luukvbaal <luukvbaal@gmail.com>
This commit is contained in:
neovim-backports[bot]
2026-04-22 08:18:03 -04:00
committed by GitHub
parent eebd98fd99
commit 6ae6cf5d61
2 changed files with 11 additions and 2 deletions

View File

@@ -1072,6 +1072,15 @@ describe('float window', function()
command('close')
assert_alive()
end)
it('does not unload bufhidden=hide buffer', function()
local buf = api.nvim_create_buf(false, true)
command('set nohidden')
api.nvim_open_tabpage(0, true, {})
api.nvim_open_win(buf, false, { relative = 'editor', width = 1, height = 1, row = 0, col = 0 })
command('close!')
eq(true, api.nvim_buf_is_loaded(buf))
end)
end)
it('placed relative to tabline and laststatus', function()