Skip to content

fix(tui): load full transcript before PgUp/Home from scrollback tail#132

Merged
shayne-snap merged 1 commit into
mainfrom
fix/page-up-down-semantics
May 25, 2026
Merged

fix(tui): load full transcript before PgUp/Home from scrollback tail#132
shayne-snap merged 1 commit into
mainfrom
fix/page-up-down-semantics

Conversation

@shayne-snap
Copy link
Copy Markdown
Contributor

When most of the transcript has already been emitted to native scrollback (nativeScrollbackPrinted near len(transcript)), pressing PgUp or Home from the live tail scrolled within the trimmed message window and landed on the startup banner instead of real history.

What changed

  • New loadFullChatForScroll() in chat_viewport.go — loads the complete transcript via chatMessages() (bypassing the nativeScrollbackPrinted trim) and anchors it at the bottom.
  • Updated PgUp/Home handler in history_nav.go — calls the new method before the scroll action so the subsequent chat.PageUp()/chat.ScrollToTop() walks the real history.
  • New test TestPageUpAtTailRevealsTranscriptAboveScrollbackBoundary — verifies that PgUp from tail exposes entries above the scrollback boundary, not just the trimmed window.

Why not change refreshViewportContentFollow?

The follow-tail refresh must keep trimming for performance on streaming/append paths. The full-load is intentionally a one-shot pre-scroll step.

When most of the transcript has already been emitted to native scrollback
(nativeScrollbackPrinted near len(transcript)), the follow-tail refresh
trims messages to nativeScrollbackPrinted: for performance. Pressing
PgUp or Home from the live tail then scrolled within that tiny window,
landing on the startup banner instead of the actual history.

Fix by introducing loadFullChatForScroll() which loads the complete
transcript (via chatMessages() instead of the trimmed
chatViewportMessages()) and anchors it at the bottom, so the subsequent
chat.PageUp() / chat.ScrollToTop() walks the real history.
@shayne-snap shayne-snap merged commit aa72c7b into main May 25, 2026
2 checks passed
@shayne-snap shayne-snap deleted the fix/page-up-down-semantics branch May 25, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant