fix: git_branch previewer highlighter error (#1543)

This commit is contained in:
Simon Hauser
2021-12-05 08:39:16 +01:00
committed by GitHub
parent 1131e5f9e1
commit d0083f9e4c

View File

@@ -638,19 +638,43 @@ previewers.git_branch_log = defaulter(function(opts)
if hstart then
local hend = hstart + 7
if hend < #line then
vim.api.nvim_buf_add_highlight(bufnr, ns_previewer, "TelescopeResultsIdentifier", i - 1, hstart - 1, hend)
pcall(
vim.api.nvim_buf_add_highlight,
bufnr,
ns_previewer,
"TelescopeResultsIdentifier",
i - 1,
hstart - 1,
hend
)
end
end
local _, cstart = line:find "- %("
if cstart then
local cend = string.find(line, "%) ")
if cend then
vim.api.nvim_buf_add_highlight(bufnr, ns_previewer, "TelescopeResultsConstant", i - 1, cstart - 1, cend)
pcall(
vim.api.nvim_buf_add_highlight,
bufnr,
ns_previewer,
"TelescopeResultsConstant",
i - 1,
cstart - 1,
cend
)
end
end
local dstart, _ = line:find " %(%d"
if dstart then
vim.api.nvim_buf_add_highlight(bufnr, ns_previewer, "TelescopeResultsSpecialComment", i - 1, dstart, #line)
pcall(
vim.api.nvim_buf_add_highlight,
bufnr,
ns_previewer,
"TelescopeResultsSpecialComment",
i - 1,
dstart,
#line
)
end
end
end