Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions lua/blame/blame_stack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,10 @@ function BlameStack:open_stack_info_float()

local lns = vim.api.nvim_buf_get_lines(info_buf, 0, -1, false)
for idx, v in ipairs(lns) do
vim.api.nvim_buf_add_highlight(
info_buf,
-1,
idx == #lns and string.sub(v, 0, 7) or "Comment",
idx - 1,
0,
-1
)
vim.api.nvim_buf_set_extmark(info_buf, -1, idx - 1, 0, {
end_col = -1,
hl_group = idx == #lns and string.sub(v, 0, 7) or "Comment",
})
end

local width = utils.longest_string_in_array(lines_text) + 5
Expand All @@ -227,14 +223,10 @@ function BlameStack:open_stack_info_float()
end
vim.api.nvim_buf_set_lines(info_buf, 0, -1, false, lines_text)

vim.api.nvim_buf_add_highlight(
info_buf,
-1,
string.sub(lines_text[1], 0, 7),
0,
0,
-1
)
vim.api.nvim_buf_set_extmark(info_buf, -1, 0, 0, {
end_col = -1,
hl_group = string.sub(lines_text[1], 0, 7),
})

local width = utils.longest_string_in_array(lines_text) + 5
local height = #self.commit_stack
Expand Down
12 changes: 4 additions & 8 deletions lua/blame/commit_info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,10 @@ function CommitInfo:open(commit)

for idx, line in ipairs(formatted_commit) do
local key_end = string.find(line, ":") - 1
vim.api.nvim_buf_add_highlight(
info_buf,
self.config.ns_id,
"Comment",
idx - 1,
0,
key_end
)
vim.api.nvim_buf_set_extmark(info_buf, self.config.ns_id, idx - 1, 0, {
end_col = key_end,
hl_group = "Comment",
})
end

mappings.set_keymap(
Expand Down
8 changes: 5 additions & 3 deletions lua/blame/views/window_view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,15 @@ function WindowView:add_highlights(lines_with_hl)
local startindex, endindex =
string.find(text_line, value.textValue, nil, true)
if startindex ~= nil and endindex ~= nil then
vim.api.nvim_buf_add_highlight(
vim.api.nvim_buf_set_extmark(
vim.api.nvim_win_get_buf(self.blame_window),
self.config.ns_id,
value.hl,
line.idx - 1,
startindex - 1,
endindex
{
end_col = endindex,
hl_group = value.hl,
}
)
end
end
Expand Down