fix: measure timeline rows so the virtual window tracks real heights - #415
Merged
Conversation
The timeline virtualizer sized its window, spacers, and reveal math from a fixed 52px row estimate. Real rows render systematically taller when the master pane is narrow (the meta line wraps) and shorter under compact density, so the post-reveal repaint re-anchored rows against wrong spacer heights and pushed the cursor row out of the viewport. The lens now re-derives its estimate from the mean measured height of the painted rows, keeping 52px as the guarded fallback when there is no layout. A debounced ResizeObserver on the timeline element re-measures on every width-changing trigger (divider release, window resize, the narrow media query, pane open/close, reading mode); the composition root routes the density toggle explicitly, since it changes row heights without a width signal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #412.
The timeline virtualizer sized its window, spacers, and reveal math from a fixed 52px row
estimate. Real rows render systematically taller when the master pane is narrow (the
.eventmeta line wraps — easy to hit since the #411 divider) and shorter under compact density, so the
reveal path's post-
scrollIntoViewrepaint re-anchored rows against wrong spacer heights andpushed the cursor row out of the viewport ("the cursor gets lost in the stack").
Direction (from the issue's three candidates): measure a representative painted row — the
uniform-estimate window model is kept intact, and the estimate is made true.
ROW_H = 52stays as the fallback; a liverowHestimate — the mean measuredgetBoundingClientRect().heightof painted rows, unrounded — feedsvisibleRange, bothspacers, and
scrollTimelineSelectionIntoView. Guards keep the current estimate when there isnothing to measure (empty state, no layout).
ResizeObserveron#timelinecovers everywidth-changing signal in one place (divider release, window resize, the narrow media query,
pane open/close, reading mode, and feat: add h/l keys to resize the inspector split from anywhere #414's
h/lkeys via the sameapplySplitwrite); thecomposition root routes the density toggle explicitly (height-only, no width signal); the first
laid-out paint seeds the estimate; the reveal re-measures synchronously before seeding scroll
(the load path measures at full width, then the route opens the split and reflows rows before
the deep-link reveal runs).
anchoredScrollTop):the painted row straddling the viewport top keeps its exact offset, with index-space scaling as
the no-layout fallback — a density flip no longer teleports the content.
Verification: 9 new vitest specs (642 total green), full
just check(2172), and live Chromeagainst a 3000+-event store — divider at ~406px with wrapped ~126px rows, 40×
j/20×kcursorstepping stays centered; density flip re-derives
126→100 and keeps the cursor visible; freshdeep-link load reveals centered.
Shoreline: revision
rev:2f669a77was re-captured asrev:73ed4615(supersedes) after rebasingonto #414; Codex reviewer
agent:codex-412accepted with independent gate re-runs; the oneadvisory (residual density-flip nudge) was owner-approved and closed.