Skip to content

Commit

Permalink
Fix off-by-one moved parent highlight target
Browse files Browse the repository at this point in the history
  • Loading branch information
rbong committed Sep 25, 2024
1 parent 8fa598b commit 6f80c1f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lua/flog/highlight.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,16 @@ function M.nvim_get_graph_hl_callback(buffer, instance_number)
if merge_memo[line] == nil then
merge_memo[line] = 1
local merge_col = vim.fn.virtcol2col(winid, line, 2 * commit.merge_branch_index)
local end_merge_col = vim.fn.virtcol2col(winid, line, 2 * commit.merge_end_branch_index - 2)
local end_merge_col = vim.fn.virtcol2col(winid, line, 2 * commit.merge_end_branch_index - 1)

-- Set highlight groups for merge
if commit.moved_parent then
local commit_col = vim.fn.virtcol2col(winid, line, 2 * commit.branch_index - 1)

vim.api.nvim_buf_add_highlight(
buffer,
-1,
hl_group_names[current_hl[commit.merge_end_branch_index] or commit_hl_cache[commit.merge_end_branch_index]],
line - 1,
commit_col,
vim.fn.virtcol2col(winid, line, 2 * commit.branch_index) - 1,
end_merge_col)
else
vim.api.nvim_buf_add_highlight(
Expand Down

0 comments on commit 6f80c1f

Please sign in to comment.