Repository navigation
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
The fix works. I ran the #57059 reproduction (30 turns, scroll up a few wheel steps, press alt+up) on the base and with this PR. On the base, the first press lands on Prompt 11. With this PR, it lands on Prompt 28, the previous user prompt above the viewport, and the second press steps to Prompt 27. The new test passes 5 runs in a row and fails on the base. typecheck in packages/tui passes.
I checked the cancellation paths. A manual scroll during mounting keeps the same pending list, so the offset correction and the final cleanup still run. The new early return only fires after toBottom(), which resets the scroll state itself. Pinning to the bottom is turned back on by updateAwayFromBottom. Rows mounted below the view don't move the anchor, so they aren't offset.
Public API: unchanged (internal to the TUI session route).
No blocking concerns.


Issue for this PR
Closes #57059
Type of change
What does this PR do?
The first message jump after scrolling a long transcript can land near its beginning because mounting older rows changes the content above the viewport. Retain a mounted anchor's content position, compensate for that insertion, then let layout settle before choosing the next boundary. The content-coordinate delta also preserves manual scrolling that cancels a pending jump and excludes rows added below the reader.
Thanks to @xuwangaa for the report and root-cause analysis.
How did you verify your code works?
devat both 44- and 100-column widths. It covers the first jump after scrolling, repeated previous/next, a first jump from the bottom, and manual cancellation during mounting.bun run checktasks pass. Windows's tracked declaration symlink placeholder was temporarily materialized from its target and restored.AI-assisted; reviewed and tested locally.
Screenshots / recordings
Actual 100x30 fixture frames, rendered to PNG. The same first previous-user command should reach Prompt 28:
Checklist