mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 00:49:03 +02:00
fix(ui): properly clear maximize state on exit. See #4934
This commit is contained in:
parent
d71471151b
commit
9ec253b9b6
1 changed files with 4 additions and 3 deletions
|
@ -34,7 +34,8 @@ end
|
||||||
function M.maximize()
|
function M.maximize()
|
||||||
---@type {k:string, v:any}[]?
|
---@type {k:string, v:any}[]?
|
||||||
local maximized = nil
|
local maximized = nil
|
||||||
return Snacks.toggle({
|
local ret
|
||||||
|
ret = Snacks.toggle({
|
||||||
name = "Maximize",
|
name = "Maximize",
|
||||||
get = function()
|
get = function()
|
||||||
return maximized ~= nil
|
return maximized ~= nil
|
||||||
|
@ -54,11 +55,10 @@ function M.maximize()
|
||||||
-- `QuitPre` seems to be executed even if we quit a normal window, so we don't want that
|
-- `QuitPre` seems to be executed even if we quit a normal window, so we don't want that
|
||||||
-- `VimLeavePre` might be another consideration? Not sure about differences between the 2
|
-- `VimLeavePre` might be another consideration? Not sure about differences between the 2
|
||||||
vim.api.nvim_create_autocmd("ExitPre", {
|
vim.api.nvim_create_autocmd("ExitPre", {
|
||||||
once = true,
|
|
||||||
group = vim.api.nvim_create_augroup("lazyvim_restore_max_exit_pre", { clear = true }),
|
group = vim.api.nvim_create_augroup("lazyvim_restore_max_exit_pre", { clear = true }),
|
||||||
desc = "Restore width/height when close Neovim while maximized",
|
desc = "Restore width/height when close Neovim while maximized",
|
||||||
callback = function()
|
callback = function()
|
||||||
M.maximize.set(false)
|
ret:set(false)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
|
@ -70,6 +70,7 @@ function M.maximize()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue