Skip to content

Commit

Permalink
fix: restoring session when floating window is focused (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Sep 26, 2023
1 parent 7464a93 commit 31938d8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/resession/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,13 @@ local function open_clean_tab()
end

local function close_everything()
local is_floating_win = vim.api.nvim_win_get_config(0).relative ~= ""
if is_floating_win then
-- Go to the first window, which will not be floating
vim.cmd.wincmd({ args = { "w" }, count = 1 })
end

local scratch = vim.api.nvim_create_buf(false, true)
vim.api.nvim_buf_set_option(scratch, "buflisted", false)
vim.api.nvim_buf_set_option(scratch, "bufhidden", "wipe")
vim.api.nvim_win_set_buf(0, scratch)
for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do
Expand Down

0 comments on commit 31938d8

Please sign in to comment.