fix(history): preserve branch colors across parent lanes

Keep branch metadata attached to each parent lane so the history graph
can render consistent colors and markers after merges and branch
transitions. Also soften the styling for behind-path segments to better
match the updated dot coloring.
This commit is contained in:
Christoph Brandau
2026-08-10 10:48:31 +02:00
parent eb65c1def7
commit f88b6961d1
2 changed files with 9 additions and 7 deletions
+3 -4
View File
@@ -2689,9 +2689,8 @@
filter: drop-shadow(0 0 3px rgba(224,160,64,0.24)); filter: drop-shadow(0 0 3px rgba(224,160,64,0.24));
} }
.graph-svg path.graph-segment-behind { .graph-svg path.graph-segment-behind {
stroke: #7aacff;
stroke-dasharray: 4 4; stroke-dasharray: 4 4;
filter: drop-shadow(0 0 3px rgba(122,172,255,0.24)); filter: drop-shadow(0 0 3px rgba(122,172,255,0.2));
} }
.graph-dot { .graph-dot {
position: absolute; position: absolute;
@@ -2715,8 +2714,8 @@
box-shadow: 0 0 0 1px rgba(224,160,64,0.42), 0 0 10px rgba(224,160,64,0.16); box-shadow: 0 0 0 1px rgba(224,160,64,0.42), 0 0 10px rgba(224,160,64,0.16);
} }
.graph-dot.behind { .graph-dot.behind {
background: #7aacff; background: var(--dot-color, #5a8cf8);
box-shadow: 0 0 0 1px rgba(122,172,255,0.46), 0 0 10px rgba(122,172,255,0.18); box-shadow: 0 0 0 1px var(--dot-color, #5a8cf8), 0 0 10px rgba(122,172,255,0.18);
} }
.graph-dot.tip { width: 14px; height: 14px; box-shadow: 0 0 0 1px var(--dot-color, #5a8cf8); } .graph-dot.tip { width: 14px; height: 14px; box-shadow: 0 0 0 1px var(--dot-color, #5a8cf8); }
.graph-dot.merge { .graph-dot.merge {
+6 -3
View File
@@ -140,15 +140,18 @@
const currentBranches = branchMembership.get(commit.hash) ?? localBranchRefs(commit); const currentBranches = branchMembership.get(commit.hash) ?? localBranchRefs(commit);
const commitBranches = uniqueStrings([...(beforeBranches[col] ?? []), ...currentBranches]); const commitBranches = uniqueStrings([...(beforeBranches[col] ?? []), ...currentBranches]);
after[col] = commit.parents.length > 0 ? commit.parents[0] : null; const firstParent = commit.parents[0] ?? null;
afterBranches[col] = after[col] ? commitBranches.slice() : []; after[col] = firstParent;
afterBranches[col] = firstParent
? (branchMembership.get(firstParent) ?? commitBranches).slice()
: [];
const fromCommit = new Set<number>([col]); const fromCommit = new Set<number>([col]);
for (let p = 1; p < commit.parents.length; p++) { for (let p = 1; p < commit.parents.length; p++) {
let slot = after.indexOf(null); let slot = after.indexOf(null);
if (slot === -1) { slot = after.length; after.push(null); afterBranches.push([]); } if (slot === -1) { slot = after.length; after.push(null); afterBranches.push([]); }
after[slot] = commit.parents[p]; after[slot] = commit.parents[p];
afterBranches[slot] = []; afterBranches[slot] = (branchMembership.get(commit.parents[p]) ?? commitBranches).slice();
fromCommit.add(slot); fromCommit.add(slot);
} }