fix(tui): stabilize sticky prompt tracking

Keep the latest prompt sticky while the viewport is in live assistant output beyond history, and clear stale sticky state at the real bottom using fresh scroll height.
This commit is contained in:
Brooklyn Nicholson 2026-04-28 22:10:40 -05:00
parent afb20a1d67
commit ce2cc7302e
5 changed files with 62 additions and 7 deletions

View file

@ -35,4 +35,20 @@ describe('viewportStore', () => {
})
expect(viewportSnapshotKey(snap)).toBe('0:16:5:40:3')
})
it('uses fresh scroll height to clear stale non-bottom state', () => {
const handle = {
getFreshScrollHeight: () => 20,
getPendingDelta: () => 0,
getScrollHeight: () => 40,
getScrollTop: () => 15,
getViewportHeight: () => 5,
isSticky: () => false
}
const snap = getViewportSnapshot(handle as any)
expect(snap.atBottom).toBe(true)
expect(snap.scrollHeight).toBe(20)
})
})