fix(ui-tui): hide stale sticky prompt when newer prompt is visible
Sticky prompt selection only considered the top edge of the viewport, so it could keep showing an older user prompt even when a newer one was already visible lower down. Suppress sticky output whenever a user message is visible in the viewport and cover it with a regression test.
This commit is contained in:
@@ -270,7 +270,7 @@ export function StickyPromptTracker({ messages, offsets, scrollRef, onChange }:
|
||||
const vp = Math.max(0, s?.getViewportHeight() ?? 0)
|
||||
const total = Math.max(vp, s?.getScrollHeight() ?? vp)
|
||||
const atBottom = (s?.isSticky() ?? true) || top + vp >= total - 2
|
||||
const text = stickyPromptFromViewport(messages, offsets, top, atBottom)
|
||||
const text = stickyPromptFromViewport(messages, offsets, top + vp, top, atBottom)
|
||||
|
||||
useEffect(() => onChange(text), [onChange, text])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user