fix(win): don't force close modified buffers

This commit is contained in:
Folke Lemaitre 2024-11-30 21:47:33 +01:00
parent b813c3383c
commit d517b11cab
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -218,6 +218,14 @@ function M:close(opts)
local win = self.win
local buf = wipe and self.buf
-- never close modified buffers
if buf and vim.bo[buf].modified then
if not pcall(vim.api.nvim_buf_delete, buf, { force = false }) then
return
end
end
self.win = nil
if buf then
self.buf = nil