mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
fix(dashboard): prevent starting picker twice when no session manager. Fixes #783
Some checks failed
CI / ci (push) Failing after 0s
Some checks failed
CI / ci (push) Failing after 0s
This commit is contained in:
parent
8574f1964d
commit
2f396b341d
2 changed files with 6 additions and 5 deletions
|
@ -909,15 +909,13 @@ function M.sections.projects(opts)
|
|||
if opts.action then
|
||||
return opts.action(dir)
|
||||
end
|
||||
vim.fn.chdir(dir)
|
||||
local session = M.sections.session()
|
||||
-- stylua: ignore
|
||||
if opts.session then
|
||||
if opts.session and session then
|
||||
local session_loaded = false
|
||||
vim.api.nvim_create_autocmd("SessionLoadPost", { once = true, callback = function() session_loaded = true end })
|
||||
vim.defer_fn(function() if not session_loaded and opts.pick then M.pick() end end, 100)
|
||||
end
|
||||
vim.fn.chdir(dir)
|
||||
local session = M.sections.session()
|
||||
if opts.session and session then
|
||||
self:action(session.action)
|
||||
elseif opts.pick then
|
||||
M.pick()
|
||||
|
|
|
@ -822,6 +822,9 @@ function M:show()
|
|||
end
|
||||
if main then
|
||||
vim.schedule(function()
|
||||
if not self:valid() then
|
||||
return
|
||||
end
|
||||
vim.api.nvim_win_set_buf(self.win, self.buf)
|
||||
vim.api.nvim_win_set_buf(main, buf)
|
||||
vim.api.nvim_set_current_win(main)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue