Skip to content

Commit

Permalink
Reset highlighting for branch moved under commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rbong committed Aug 21, 2024
1 parent 68e3d84 commit 688f9e1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lua/flog/graph.lua
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ function M.get_graph(
end
end

-- Update moved commit branch highlighting
-- Update commit branch highlighting to parent branch
if is_nvim and ncommit_parents == 1 and ncommit_new_parents == 1 then
local parent_branch_index = branch_indexes[commit_new_parents[1]]
local new_parent_hl = current_hl[commit_branch_index]
Expand Down Expand Up @@ -921,6 +921,15 @@ function M.get_graph(
end
end

-- Reset branch highlighting for moved parent branch
if should_move_last_parent_under_commit then
local new_hl = (commit_merge_end_branch_index - 1) % 9 + 1
if new_hl ~= current_hl[commit_merge_end_branch_index] then
next_commit_hl[commit_merge_end_branch_index] = new_hl
current_hl[commit_merge_end_branch_index] = new_hl
end
end

-- Reset branch highlighting for removed missing branches
for missing_parent_index = 1, nmissing_parents do
local branch_index = branch_indexes[missing_parents[missing_parent_index]]
Expand Down

0 comments on commit 688f9e1

Please sign in to comment.