Skip to content

feat(native): timeline minimap - #71

Merged
rynfar merged 2 commits into
nativefrom
nw/70-minimap
Nov 2, 2026
Merged

rynfar merged 2 commits into
nativefrom
nw/70-minimap

Conversation

@rynfar

@rynfar rynfar commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Problem

The native transcript had no timeline minimap, so long threads offered no overview of their turns and no way to jump between them. Closes #70 (ledger row TV-MINIMAP).

Approach

Ported TimelineMinimap.tsx, timelineMinimapItems.ts and the minimap half of MessagesTimeline.logic.ts / MessagesTimeline.tsx. No client setting gates it on the web, so none does here.

  • Core (crates/core/src/timeline/minimap.rs, pure, tested):
    • deriveTimelineMinimapItems: one item per user message with its turn's final answer. Attachment-only prompts, with or without Ultrathink:, show as "User message".
    • resolveTimelineMinimapPreview: the first 1,500 UTF-16 units of the answer go through markdown-rs (the same mdast as remark + GFM, already in the lock through gpui-component), then the web's markdownNodeText rules. Those rules cover inline vs block joins, image alts, raw HTML (comments dropped, block tags as spaces) and thread autolinks as "a thread". The expected strings in the test were produced by running the web function on the same inputs.
    • Rail geometry (8px spacing capped at 100vh - 18rem, topPercent, pointer → index), isTimelineMinimapRowVisible, resolveTimelineMinimapCurrentIndex, the persistent-gutter / hit-strip / navigation-reach rules, and visible_range. The web rechecks LegendList's rendered buffer. GPUI's height tree places every row, so native binary-searches positions with the same per-row test (a row with no height counts as 1px).
    • jump_anchor: puts a jumped-to message 24px below the top (viewOffset) by walking up through measured rows. If it reaches an unmeasured row, the rest of the offset is scrolled once that row is laid out.
  • App (crates/app/src/thread_view/minimap.rs): the 72px overlay on the transcript's left edge. It has the rail line, 2px strips with the 1 / .667 / .417 / .333 fisheye, and in-view strips lit with foreground/55. The preview card is dropdown glass, 320px wide, one truncated line plus three clamped lines, centred on its strip (or hanging from the first / last). Clicking or scrubbing jumps; a press that starts elsewhere passes over the rail. Previous / Next turn are icon-micro ghost-muted buttons that show on hover and carry tooltips. The rail is always visible when the side gutter is ≥ 48px. With a narrower gutter it shows only on hover, and is inert below a 12px hit strip, which covers side chats in narrow panels.
  • Performance: the strips are painted by one canvas. Its prepaint runs after the list's layout and reads the visible range from the list's height tree, so lit strips are correct in the same frame and no row has to be measured. Only a change of current turn or gutter requests one more render (on_next_frame), like the web's setState. Nothing animates and nothing repaints while idle. Items are re-derived only when rows change; the preview is parsed only for the hovered item and cached while its text is unchanged.
  • Snapshot renderer: --hover x,y leaves the pointer on a point. pump now delivers on_next_frame callbacks, because the test platform has no display link.

Not ported (row is partial)

  • Keyboard: the web's rail is a Tab stop with arrows, Home / End and Enter. The native transcript has no Tab order yet.
  • The preview text can't be selected (the web has select-text).
  • Jumps don't smooth-scroll (this matches the web's reduced-motion path). The 150ms fade and fisheye transitions snap instead of animating.
  • Nav tooltips use gpui-component's default placement, not top / bottom.

Ledger

TV-MINIMAP → partial, Native = crates/app/src/thread_view/minimap.rs, crates/core/src/timeline/minimap.rs, Issue #70. Web source also lists timelineMinimapItems.ts, so upstream changes to it get triaged here.

Evidence

  • Tests (timeline::minimap::tests, 6): items_are_user_messages_with_their_turns_final_answer, previews_read_markdown_as_the_web_does (10 inputs, outputs taken from the web function), rail_geometry_follows_the_web, the_visible_range_and_current_item_follow_the_scroll, the_gutter_decides_whether_the_rail_shows_and_takes_the_pointer, a_jump_anchors_above_the_message_through_measured_rows.
  • Real window, smoke server, "Turn 1: page history test" (8 loaded turns), before and after:
    • /private/tmp/claude-501/-Volumes-DevSSD-t3code-native/15deb025-b650-4cf9-a1aa-1cc16b006f6d/scratchpad/shots70/before.png / /private/tmp/claude-501/-Volumes-DevSSD-t3code-native/15deb025-b650-4cf9-a1aa-1cc16b006f6d/scratchpad/shots70/after.png
    • crops /private/tmp/claude-501/-Volumes-DevSSD-t3code-native/15deb025-b650-4cf9-a1aa-1cc16b006f6d/scratchpad/shots70/before-crop.png / /private/tmp/claude-501/-Volumes-DevSSD-t3code-native/15deb025-b650-4cf9-a1aa-1cc16b006f6d/scratchpad/shots70/after-crop.png
  • Driven states (offscreen renderer, same thread):
    • /private/tmp/claude-501/-Volumes-DevSSD-t3code-native/15deb025-b650-4cf9-a1aa-1cc16b006f6d/scratchpad/shots70/snap-hover.png: hover, fisheye and preview, dark
    • /private/tmp/claude-501/-Volumes-DevSSD-t3code-native/15deb025-b650-4cf9-a1aa-1cc16b006f6d/scratchpad/shots70/snap-hover-light.png: last-but-one item, light
    • /private/tmp/claude-501/-Volumes-DevSSD-t3code-native/15deb025-b650-4cf9-a1aa-1cc16b006f6d/scratchpad/shots70/snap-click.png: click on the first strip. Turn 7 sits 24px below the top, and strips 1–2 are lit.
    • /private/tmp/claude-501/-Volumes-DevSSD-t3code-native/15deb025-b650-4cf9-a1aa-1cc16b006f6d/scratchpad/shots70/snap-nav.png: Previous turn shown with its tooltip
    • /private/tmp/claude-501/-Volumes-DevSSD-t3code-native/15deb025-b650-4cf9-a1aa-1cc16b006f6d/scratchpad/shots70/snap-prev.png: Previous turn twice, Turn 14 → 12
  • Gates: cargo clippy --workspace --all-targets -- -D warnings ✓ (and -p t3-native --features snapshot), cargo test --workspace ✓, node scripts/gen-theme.ts --check ✓, node --test parity/sync.test.ts ✓, node ../../apps/native/conformance/generate.ts --check ✓.

@rynfar

rynfar commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Review fixes in 09fa169. Both findings were real.

1. Stale press after a release off the rail. Confirmed: pressed_on_strip was only cleared by an up or a button-free move that hit the rail's own hitbox. The press state is now a pure RailPointer in crates/core/src/timeline/minimap.rs. It covers pressedOnStripRef plus the web's window mouseup and button-free mousemove resets. The rail feeds it every left press and release, on the rail or off it, through on_mouse_down / on_mouse_down_out / on_mouse_up / on_mouse_up_out, plus moves over the rail.

only_a_press_that_starts_on_the_rail_scrubs_or_jumps covers click and scrub, a drag from elsewhere, your scenario (press on the rail, release off it, then drag in from elsewhere and release on the rail), and a missed release. I checked it against the old delivery, where off-rail downs and ups never reach the rail: it fails with [Ignore, Ignore, Ignore, Ignore, Track, Jump].

2. Wheel over the preview reaching a scroller underneath. Confirmed in GPUI's hit_test: BlockMouseExceptScroll keeps every hitbox under the point in ids, so should_handle_scroll lets a nested overflow_y_scroll take the wheel. The rail and the preview now occlude(), which stops the hit test at them, and they forward the wheel to the transcript (forwardWheelToTimeline). Ctrl or zero-Y wheels aren't forwarded.

My first version forwarded through ListState::scroll_by. It did nothing while the list was pinned to the bottom, because there it measures from the item count, not from the viewport top. It now goes through scroll_px_offset_for_scrollbar / set_offset_from_scrollbar. That clamps like the list's own wheel and goes back to following the end at the bottom.

Verified offscreen with a new --scroll x,y,dy snapshot option. Hovering a strip opens the preview; a 300px wheel over the preview then scrolls the transcript and the card stays open: /private/tmp/claude-501/-Volumes-DevSSD-t3code-native/15deb025-b650-4cf9-a1aa-1cc16b006f6d/scratchpad/shots70/snap-wheel.png (compare /private/tmp/claude-501/-Volumes-DevSSD-t3code-native/15deb025-b650-4cf9-a1aa-1cc16b006f6d/scratchpad/shots70/snap-hover.png).

Gates are green again. fork/native had not moved, so the rebase was a no-op.

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