From 82bd4b59432d44cf5e2a5ce3a40a037a575a6623 Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Sun, 20 Oct 2024 08:04:43 +0300 Subject: [PATCH] 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 --- lua/cmp/view/ghost_text_view.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/cmp/view/ghost_text_view.lua b/lua/cmp/view/ghost_text_view.lua index db5e2f0..a6457f1 100644 --- a/lua/cmp/view/ghost_text_view.lua +++ b/lua/cmp/view/ghost_text_view.lua @@ -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