Keep the session in the terminal's own scrollback - #55
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scrolling up showed only the shell line from before launch. The app ran on the
alternate screen, which has no scrollback, and repainted one screenful per
frame — earlier output was never written to the real buffer.
Changes
An inline viewport owns a 12-row strip at the bottom; finished output is printed
above it as ordinary terminal output. The terminal then owns the history: wheel,
selection and its own search all work, and it survives quitting.
Streaming text is pushed up a completed line at a time, so a long reply scrolls
the terminal instead of being squeezed into the strip. Only the half-written
last line stays in the viewport.
Nothing prints twice:
Message.contentkeeps the whole reply for the wire whiledisplaycarries only the part the terminal has not had. Trimmingcontentwould truncate what the model sees.
Completed messages print immediately rather than waiting for the turn to end —
holding them meant your prompt appeared after the answer to it, since the
answer streamed out while the prompt waited.
The fixed viewport height works because the approval prompt scrolls inside its
own box rather than growing.
Fallback
Inline viewports need a cursor-position report. If the terminal does not answer,
this falls back to the full screen and says so rather than failing to start.
Verified
Instrumented what actually reached scrollback on a pty: prompt before reply,
each paragraph inserted exactly once, no alternate screen. 353 tests; clippy
identical to main.
Bumped 0.9.5 → 0.10.0 — minor, since it changes how the app occupies your terminal.