Skip to content

Commit 5dd4d50

Browse files
committed
Fix :ga from within REPL
`:ga` Needed to be executed twice if executed from within the REPL buffer due to a `nvim_buf_delete`/`nvim_win_close` running into a "Cannot close last window" error. This replaces the close call with a `modified` change, which serves the purpose of not blocking an exit if the REPL prompt buffer is modified.
1 parent cc77338 commit 5dd4d50

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

lua/dap.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ api.nvim_create_autocmd("ExitPre", {
13741374
---@diagnostic disable-next-line: redundant-return-value
13751375
return session == nil and next(sessions) == nil
13761376
end)
1377-
M.repl.close()
1377+
M.repl._exit()
13781378
if _log then
13791379
_log:close()
13801380
end

lua/dap/repl.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,4 +618,12 @@ do
618618
end
619619

620620

621+
function M._exit()
622+
local buf = repl.buf
623+
if buf and vim.bo[buf].modified then
624+
vim.bo[buf].modified = false
625+
end
626+
end
627+
628+
621629
return M

0 commit comments

Comments
 (0)