Avoid calling del_extmark on non existing buffer (#2053)

This fixes a problem with Neogit is discussed here:

https://github.com/NeogitOrg/neogit/discussions/1492
This commit is contained in:
Roey Darwish Dror
2024-10-20 08:04:43 +03:00
committed by GitHub
parent cc683345c9
commit 82bd4b5943

View File

@@ -32,7 +32,9 @@ ghost_text_view.new = function()
vim.api.nvim_set_decoration_provider(ghost_text_view.ns, {
on_win = function(_, win)
if self.extmark_id then
vim.api.nvim_buf_del_extmark(self.extmark_buf, ghost_text_view.ns, self.extmark_id)
if vim.api.nvim_buf_is_loaded(self.extmark_buf) then
vim.api.nvim_buf_del_extmark(self.extmark_buf, ghost_text_view.ns, self.extmark_id)
end
self.extmark_id = nil
end