fix: switch to an invalid window (#171)
This commit is contained in:
parent
79e9aac1af
commit
a3c2a9a0d5
@ -99,6 +99,7 @@ function Sidebar:open()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Sidebar:close()
|
function Sidebar:close()
|
||||||
|
self:delete_autocmds()
|
||||||
for _, comp in pairs(self) do
|
for _, comp in pairs(self) do
|
||||||
if comp and type(comp) == "table" and comp.unmount then
|
if comp and type(comp) == "table" and comp.unmount then
|
||||||
comp:unmount()
|
comp:unmount()
|
||||||
@ -827,9 +828,10 @@ function Sidebar:refresh_winids()
|
|||||||
local current_idx = Utils.tbl_indexof(winids, current_winid) or 1
|
local current_idx = Utils.tbl_indexof(winids, current_winid) or 1
|
||||||
if current_idx == #winids then
|
if current_idx == #winids then
|
||||||
current_idx = 1
|
current_idx = 1
|
||||||
api.nvim_set_current_win(winids[current_idx])
|
|
||||||
else
|
else
|
||||||
current_idx = current_idx + 1
|
current_idx = current_idx + 1
|
||||||
|
end
|
||||||
|
if api.nvim_win_is_valid(winids[current_idx]) then
|
||||||
api.nvim_set_current_win(winids[current_idx])
|
api.nvim_set_current_win(winids[current_idx])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -839,9 +841,10 @@ function Sidebar:refresh_winids()
|
|||||||
local current_idx = Utils.tbl_indexof(winids, current_winid) or 1
|
local current_idx = Utils.tbl_indexof(winids, current_winid) or 1
|
||||||
if current_idx == 1 then
|
if current_idx == 1 then
|
||||||
current_idx = #winids
|
current_idx = #winids
|
||||||
api.nvim_set_current_win(winids[current_idx])
|
|
||||||
else
|
else
|
||||||
current_idx = current_idx - 1
|
current_idx = current_idx - 1
|
||||||
|
end
|
||||||
|
if api.nvim_win_is_valid(winids[current_idx]) then
|
||||||
api.nvim_set_current_win(winids[current_idx])
|
api.nvim_set_current_win(winids[current_idx])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user