mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
fix(dashboard): restore showtabline/laststatus when entering another non-float window. Closes #1774
This commit is contained in:
parent
ce8d36564c
commit
cc69a9304b
1 changed files with 17 additions and 2 deletions
|
|
@ -1193,13 +1193,28 @@ function M.setup()
|
||||||
local options = { showtabline = vim.o.showtabline, laststatus = vim.o.laststatus }
|
local options = { showtabline = vim.o.showtabline, laststatus = vim.o.laststatus }
|
||||||
vim.o.showtabline, vim.o.laststatus = 0, 0
|
vim.o.showtabline, vim.o.laststatus = 0, 0
|
||||||
local dashboard = M.open({ buf = buf, win = wins[1] })
|
local dashboard = M.open({ buf = buf, win = wins[1] })
|
||||||
D.on("Closed", function()
|
|
||||||
|
local function restore()
|
||||||
for k, v in pairs(options) do
|
for k, v in pairs(options) do
|
||||||
if vim.o[k] == 0 and v ~= 0 then
|
if vim.o[k] == 0 and v ~= 0 then
|
||||||
vim.o[k] = v
|
vim.o[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end, dashboard.augroup)
|
options = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
D.on("Closed", restore, dashboard.augroup)
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("WinEnter", {
|
||||||
|
group = dashboard.augroup,
|
||||||
|
callback = function()
|
||||||
|
local win = vim.api.nvim_get_current_win()
|
||||||
|
local is_float = vim.api.nvim_win_get_config(win).relative ~= ""
|
||||||
|
if win ~= dashboard.win and not is_float then
|
||||||
|
restore()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
if Snacks.config.dashboard.debug then
|
if Snacks.config.dashboard.debug then
|
||||||
Snacks.debug.stats({ min = 0.2 })
|
Snacks.debug.stats({ min = 0.2 })
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue