Skip to content

Commit

Permalink
fix: Using a pcall prevents spectre from crashing if a hl group fail …
Browse files Browse the repository at this point in the history
…to be generated.
  • Loading branch information
Zeioth committed Oct 6, 2023
1 parent 97cfd1b commit 6b18fe2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/spectre/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ M.render_filename = function(bufnr, namespace, line, entry)
end
local pos = 0
for _, value in pairs(hl) do
pcall(function()
api.nvim_buf_add_highlight(bufnr,
namespace,
value[2],
Expand All @@ -103,6 +104,7 @@ M.render_filename = function(bufnr, namespace, line, entry)
pos + value[1][2]
)
pos = value[1][2] + pos
end)
end
end

Expand Down

0 comments on commit 6b18fe2

Please sign in to comment.