mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
fix root inside win open
This commit is contained in:
parent
8ca577b4b5
commit
3f8cf3e812
2 changed files with 3 additions and 2 deletions
|
@ -173,7 +173,7 @@ function M.get(cmd, opts)
|
|||
opts = opts or {}
|
||||
local id = vim.inspect({ cmd = cmd, cwd = opts.cwd, env = opts.env, count = vim.v.count1 })
|
||||
local created = false
|
||||
if not (terminals[id] and terminals[id]:win_valid() and terminals[id]:buf_valid()) and (opts.create ~= false) then
|
||||
if not (terminals[id] and terminals[id]:buf_valid()) and (opts.create ~= false) then
|
||||
local ret = M.open(cmd, opts)
|
||||
ret:on("BufWipeout", function()
|
||||
terminals[id] = nil
|
||||
|
|
|
@ -701,7 +701,7 @@ function M:open_win()
|
|||
elseif position == "current" then
|
||||
self.win = vim.api.nvim_get_current_win()
|
||||
else
|
||||
local parent = self.opts.win or 0
|
||||
local parent = self:win_valid() and self.opts.win or 0
|
||||
local vertical = position == "left" or position == "right"
|
||||
if parent == 0 then
|
||||
for _, win in ipairs(vim.api.nvim_tabpage_list_wins(0)) do
|
||||
|
@ -717,6 +717,7 @@ function M:open_win()
|
|||
break
|
||||
end
|
||||
end
|
||||
self.opts.win = parent
|
||||
end
|
||||
local cmd = split_commands[relative][position]
|
||||
local size = vertical and opts.width or opts.height
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue