Skip to content

Fix Graph layout issues: empty branches, child-branch packing, merge rings#76

Merged
danipen merged 13 commits into
mainfrom
fix-layout-issues
Jul 4, 2026
Merged

Fix Graph layout issues: empty branches, child-branch packing, merge rings#76
danipen merged 13 commits into
mainfrom
fix-layout-issues

Conversation

@danipen

@danipen danipen commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

A batch of fixes to the Graph tab's layout engine (layout.ts) and canvas renderer (render.ts), plus supporting wiring. Each addresses a case where the branch diagram drew something misleading.

  • Empty (zero-commit) branches now get their own lane. A branch freshly created at another branch's commit used to vanish from the diagram (every tip walk found its commits already claimed). It now reserves an empty slot right of its anchor commit, with a fork connector showing where its first commit will grow from. origin/HEAD is excluded — it's a pointer, not a branch anyone can be on.
  • Branch selection is now matched by (name, tip) instead of tip hash alone. Empty branches share their anchor commit's hash with the owning chain and with each other, so a hash-only match lit up every one of them. New BranchSelection type + rowMatchesSelection helper thread through AppGraphViewGraphCanvasrender.
  • Child branches now pack strictly below their parent. A branch forked from the middle of a merged-away branch used to steal that branch's spine (its newer tip walked down the first-parent chain). Merged-away branches now claim before the checked-out branch, and row packing scans from the parent chain's row down — so children hang beneath parents and grandchildren beneath both, whatever the tip order.
  • Merge nodes wear a merge ring in the incoming branch's color, so a merge edge (which already carries the source branch's color) docks into a matching ring and can't be misread as a fork. Widened backing disc keeps lines docking at the ring's outer edge.
  • HEAD on a zero-commit branch moves the home badge to the empty lane (centered in the reserved slot) rather than leaving it on the anchor commit's node.
  • Day-header labels now center in their visible span and clamp against the segment's right boundary, so a day's label stays readable mid-pan without ever spilling onto the next day's label.

Testing

  • bun run typecheck
  • bun run lint
  • bun test ✅ (708 pass, 4 skip, 0 fail) — includes new layout.test.ts coverage for empty branches, child-branch packing, merge colors, and selection matching, plus geometry.test.ts and related.test.ts additions.

@danipen danipen merged commit fc55628 into main Jul 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant