You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the CLI rendering in the alternate buffer (#149), there is no terminal-managed scrollback during a session. The user cannot scroll up to see previous responses until they exit. This issue adds in-app scrollback with a history/live mode toggle.
Feature
Maintain an in-memory history buffer of all rendered output. Provide a scrollable viewport above the zone that lets the user browse previous responses during a session. Two modes: live mode (default, follows new output) and history mode (viewport pinned, new output continues in background).
Functionality
History buffer
All completed output (assistant responses, tool results, system messages) appended to an in-memory array of rendered lines
Viewport class (src/Viewport.ts) already implements a stateful scroll window over an unbounded buffer with cursor chasing. This is the core primitive needed -- the history buffer feeds into the same pipeline
layout() produces an unbounded row buffer; Viewport.resolve() slices it to screen height. History lines become additional input to this pipeline
The zone (editor, status bar) occupies fixed rows at the bottom. The scrollable history viewport is everything above the zone
Two scroll targets
There are two independently scrollable areas:
History viewport (above the zone) -- previous responses, tool output
Editor (within the zone) -- when multi-line input exceeds the zone allocation
These should be distinct scroll contexts. The active one depends on focus/mode. History mode scrolls the history viewport. Normal input scrolls the editor if it overflows.
Mode state
A simple boolean or enum on the renderer/terminal: scrollMode: 'live' | 'history'. In live mode, the viewport's scroll offset tracks the bottom of the buffer. In history mode, it's pinned to whatever position the user scrolled to. Mode transitions are triggered by keybinds and scroll-to-bottom detection.
Rendering in history mode
When pinned, new output doesn't trigger a viewport scroll -- it just appends to the buffer. The zone at the bottom still updates (status bar shows Claude is thinking, editor is responsive). Only the history area above the zone is frozen from the user's perspective.
Memory considerations
The history buffer grows unboundedly for the session. For typical CLI sessions (hundreds of responses), this is negligible. For extremely long sessions, a ring buffer or max-lines cap could be added later. Not a concern for v1.
Summary
With the CLI rendering in the alternate buffer (#149), there is no terminal-managed scrollback during a session. The user cannot scroll up to see previous responses until they exit. This issue adds in-app scrollback with a history/live mode toggle.
Feature
Maintain an in-memory history buffer of all rendered output. Provide a scrollable viewport above the zone that lets the user browse previous responses during a session. Two modes: live mode (default, follows new output) and history mode (viewport pinned, new output continues in background).
Functionality
History buffer
Live mode (default)
History mode
Returning to live mode
Scroll keybindings
Position indicator
[42/128]), percentage, or a visual scroll track on the right edgeEditor overflow
Depends on
Guidance
Existing infrastructure
Viewportclass (src/Viewport.ts) already implements a stateful scroll window over an unbounded buffer with cursor chasing. This is the core primitive needed -- the history buffer feeds into the same pipelinelayout()produces an unbounded row buffer;Viewport.resolve()slices it to screen height. History lines become additional input to this pipelineTwo scroll targets
There are two independently scrollable areas:
These should be distinct scroll contexts. The active one depends on focus/mode. History mode scrolls the history viewport. Normal input scrolls the editor if it overflows.
Mode state
A simple boolean or enum on the renderer/terminal:
scrollMode: 'live' | 'history'. In live mode, the viewport's scroll offset tracks the bottom of the buffer. In history mode, it's pinned to whatever position the user scrolled to. Mode transitions are triggered by keybinds and scroll-to-bottom detection.Rendering in history mode
When pinned, new output doesn't trigger a viewport scroll -- it just appends to the buffer. The zone at the bottom still updates (status bar shows Claude is thinking, editor is responsive). Only the history area above the zone is frozen from the user's perspective.
Memory considerations
The history buffer grows unboundedly for the session. For typical CLI sessions (hundreds of responses), this is negligible. For extremely long sessions, a ring buffer or max-lines cap could be added later. Not a concern for v1.