Skip to content

Commit

Permalink
Merge pull request #172 from Zeioth/fix-ui-lua-render-filename-highli…
Browse files Browse the repository at this point in the history
…ght-crash

fix(`ui.lua`): pcall prevents spectre from crashing on bad hl group
  • Loading branch information
EpsilonKu authored Nov 8, 2023
2 parents 2ee3496 + 6b18fe2 commit 7cce250
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 7cce250

Please sign in to comment.