Skip to content

Commit 500d8b2

Browse files
committed
fix(panel): Open the fill window in the correct tab page
1 parent 60d37f7 commit 500d8b2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lua/diffview/ui/panel.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,13 @@ end
304304
function Panel:close()
305305
if self:is_open() then
306306
local num_wins = api.nvim_tabpage_list_wins(api.nvim_win_get_tabpage(self.winid))
307+
307308
if #num_wins == 1 then
308309
-- Ensure that the tabpage doesn't close if the panel is the last window.
309-
vim.cmd("sp")
310-
File.load_null_buffer(0)
310+
api.nvim_win_call(self.winid, function()
311+
vim.cmd("sp")
312+
File.load_null_buffer(0)
313+
end)
311314
elseif self:is_focused() then
312315
vim.cmd("wincmd p")
313316
end

0 commit comments

Comments
 (0)