test(tui): clarify virtual history resize snapshot

Update the resize regression and comments so the test specifically guards viewport-height changes in the virtual-history snapshot key.
This commit is contained in:
Brooklyn Nicholson
2026-05-23 14:11:44 -05:00
parent cc61e3be49
commit d1ad919a44

View File

@@ -186,11 +186,9 @@ export function useVirtualHistory(
}, [scrollRef]) }, [scrollRef])
// Quantized snapshot: same-bin scrolls (most wheel ticks) produce the same // Quantized snapshot: same-bin scrolls (most wheel ticks) produce the same
// number → React.Object.is short-circuits the commit entirely. sticky state // key → React.Object.is short-circuits the commit entirely. The key includes
// is folded in via the sign bit so sticky→broken transitions also trigger. // sticky state, target scroll position, and viewport height so resize-only
// Uses the TARGET (committed + pendingDelta), not committed scrollTop, so // changes still recompute the mounted transcript window.
// scrollBy notifications immediately remount for the destination before
// Ink's drain frames need the children.
const subscribe = useCallback( const subscribe = useCallback(
(cb: () => void) => (hasScrollRef ? scrollRef.current?.subscribe(cb) : null) ?? NOOP, (cb: () => void) => (hasScrollRef ? scrollRef.current?.subscribe(cb) : null) ?? NOOP,
[hasScrollRef, scrollRef] [hasScrollRef, scrollRef]