Skip to content

refactor: split breadcrumb and ancestor-stack vocabulary#45

Merged
denolfe merged 1 commit into
mainfrom
refactor/ancestor-rows
Jul 26, 2026
Merged

refactor: split breadcrumb and ancestor-stack vocabulary#45
denolfe merged 1 commit into
mainfrom
refactor/ancestor-rows

Conversation

@denolfe

@denolfe denolfe commented Jul 26, 2026

Copy link
Copy Markdown
Owner

"Breadcrumb" named two unrelated things inside the sticky overlay (the region painted over the top of the viewer): the cross-document link trail, and the current heading's ancestor chain. This reserves breadcrumb and crumb for the trail, renames the heading concept to the ancestor stack, and moves the overlay's row builders out of toc-util. No behavior change.

An audit of the CLAUDE.md glossary against the code turned up the collision. The two concepts render one above the other in StickyHeader, so any sentence about "crumbs" was ambiguous about which one it meant. The glossary entry for Crumb had also gone stale, describing a shape the type no longer has.

Key Changes

  • Vocabulary split
    • BreadcrumbRow is now AncestorRow, and breadcrumbRows is now ancestorRows. Breadcrumb and crumb refer only to the cross-document trail.
    • The App and StickyHeader ends of one callback had drifted to onBreadcrumbClick and onCrumbClick. Both are now onAncestorClick.
    • Prose that said "breadcrumb overlay" now says "sticky overlay", the term already used for the region as a whole.
  • New overlay-rows module
    • The overlay's row builders moved out of toc-util. No TOC sidebar code called them.
    • fold.ts consumes the same builder the renderer does. Displayed rows and occluded rows cannot drift apart.
  • Dead code removed
    • findCurrent had no callers outside its own tests.
    • toc-util re-exported inlineVisibleWidth, which both real consumers already imported from its home module. Its tests moved there too.
  • truncateLabelLeft moved to label.ts
    • The status line is its only consumer, and nothing about it involves the TOC.
  • Glossary expanded
    • CLAUDE.md now covers modules added since it was last written, including Document, Fold, Pending target, Projection, and Cover.

"Crumb" named two different things rendered side by side in StickyHeader:
the cross-document link trail and the current heading's ancestor chain.
Reserve breadcrumb/crumb for the trail and name the heading concept the
ancestor stack.

- BreadcrumbRow -> AncestorRow, breadcrumbRows -> ancestorRows
- onBreadcrumbClick / onCrumbClick -> onAncestorClick (the App and
  StickyHeader ends of one callback had drifted to different names)
- "breadcrumb overlay" -> "sticky overlay" in prose, matching the term
  already used for the region as a whole

Move the overlay's row builders out of toc-util into overlay-rows: nothing
in the TOC sidebar called them, and fold.ts needs the same row count the
renderer produces so shown rows and occluded rows cannot drift apart.

Also drop the dead findCurrent export, drop the dead inlineVisibleWidth
re-export (its tests move to inline-width.test.ts), and move
truncateLabelLeft to label.ts — a string helper the status line owns, with
no TOC involvement.

Expand the CLAUDE.md glossary to cover the modules added since it was
written: Document, Fold, Pending target, Projection, Cover, and friends.
@github-actions

Copy link
Copy Markdown

Startup benchmark (--render test/exhaustive.md, linux-x64)

build mean ratio verdict
baseline (main@e39c971) 724.9ms ± 12.1ms
PR 722.6ms ± 10.2ms 1.00× ✅ ok

Thresholds: warn ≥ 1.1×, fail ≥ 1.25×. Baseline built from main.

@denolfe
denolfe merged commit 4fc9a88 into main Jul 26, 2026
8 checks passed
@denolfe
denolfe deleted the refactor/ancestor-rows branch July 26, 2026 18:31
denolfe added a commit that referenced this pull request Jul 26, 2026
- refactor: split breadcrumb and ancestor-stack vocabulary (#45) (4fc9a88)
- refactor(viewer): consolidate view state into a store hook (#44) (e39c971)
- refactor(viewer): extract nav-intent consumer into a pure dispatcher (#43) (8cbde71)
- refactor: consolidate heading/overlay geometry into a Fold module (#42) (bc77a33)
- refactor(viewer): extract scroll pending/pin machine into a pure reducer (#41) (a2e8062)
- feat(viewer): add a keyboard shortcut help drawer (#40) (cfb3815)
- feat(viewer): breadcrumb trail for relative-link navigation (#39) (65ffb0e)
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