From 688f9e1260d3c98be795eab197e5f9c0405e508c Mon Sep 17 00:00:00 2001 From: rbong Date: Tue, 20 Aug 2024 22:06:42 -0400 Subject: [PATCH] Reset highlighting for branch moved under commit --- lua/flog/graph.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/flog/graph.lua b/lua/flog/graph.lua index ea93522..4ccdf62 100644 --- a/lua/flog/graph.lua +++ b/lua/flog/graph.lua @@ -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] @@ -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]]