Skip to content

Commit b0563ca

Browse files
committed
fix: allow closing as the last window
1 parent 057fd28 commit b0563ca

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lua/dap-view/actions.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ M.close = function(hide_terminal)
2727
dap.repl.close({ mode = "toggle" })
2828
end
2929
if util.is_win_valid(state.winnr) then
30-
api.nvim_win_close(state.winnr, true)
30+
-- Avoid "E444: Cannot close last window"
31+
local _, ok = pcall(api.nvim_win_close, state.winnr, true)
32+
if not ok then
33+
vim.cmd("b#")
34+
end
3135
end
3236
state.winnr = nil
3337
if util.is_buf_valid(state.bufnr) then

0 commit comments

Comments
 (0)