Skip to content

Commit

Permalink
Avoid calling del_extmark on non existing buffer (#2053)
Browse files Browse the repository at this point in the history
This fixes a problem with Neogit is discussed here:

NeogitOrg/neogit#1492
  • Loading branch information
r-darwish authored Oct 20, 2024
1 parent cc68334 commit 82bd4b5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/cmp/view/ghost_text_view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 82bd4b5

Please sign in to comment.