Skip to content

Commit

Permalink
fix: guard against extmark creation errors in decoration provider
Browse files Browse the repository at this point in the history
  • Loading branch information
3rd committed Oct 17, 2023
1 parent 471eca9 commit 9bf46c1
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lua/image/image.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,19 @@ function Image:render(geometry)
filler[#filler + 1] = { { text, "" } }
end
vim.api.nvim_buf_set_extmark(self.buffer, self.global_state.extmarks_namespace, row > 0 and row - 1 or 0, 0, {
id = self.internal_id,
virt_lines = filler,
})
buf_extmark_map[self.buffer .. ":" .. row] = { id = self.internal_id, height = height }

local ok = pcall(
vim.api.nvim_buf_set_extmark,
self.buffer,
self.global_state.extmarks_namespace,
row > 0 and row - 1 or 0,
0,
{
id = self.internal_id,
virt_lines = filler,
}
)
if ok then buf_extmark_map[self.buffer .. ":" .. row] = { id = self.internal_id, height = height } end
end
end

Expand Down

0 comments on commit 9bf46c1

Please sign in to comment.