Skip to content

Commit 875b39b

Browse files
committed
fix: handle when there's only one tabpage
1 parent 7cec58c commit 875b39b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lua/neogit/lib/buffer.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ function Buffer:close(force)
226226

227227
if self.kind == "tab" then
228228
local ok, _ = pcall(vim.cmd, "tabclose")
229+
if not ok and #api.nvim_list_tabpages() == 1 then
230+
ok, _ = pcall(vim.cmd, "bd! " .. self.handle)
231+
end
229232
if not ok then
230233
vim.cmd("tab sb " .. self.handle)
231234
vim.cmd("tabclose #")

0 commit comments

Comments
 (0)