Skip to content

Allow scrolling back to view full conversation history in CLI TUI #28077

@SunkyYang

Description

@SunkyYang

Problem

In the Claude Code CLI (TUI mode), older messages in a conversation become invisible and cannot be scrolled back to, even before context compression kicks in. The terminal's own scrollback buffer (e.g., Ghostty scrollback-limit = 100000) has no effect because Claude Code uses the alternate screen buffer, which bypasses terminal scrollback entirely.

This means critical information is lost from view during a session:

  • Tool call results (file contents, command output, search results)
  • Code diffs and changes made earlier in the conversation
  • Architectural decisions and reasoning from earlier messages
  • Error messages and debugging context

There is no user-configurable setting (settings.json, environment variable, or CLI flag) to control how many messages are rendered in the TUI.

Proposed Solution

  1. Virtual scrolling in TUI - Render only visible messages in the viewport, but allow scrolling back through the full conversation history (similar to how terminal multiplexers handle scrollback)
  2. Configurable render limit - At minimum, expose a setting (e.g., maxRenderedMessages or tui.scrollbackLines) so users can control how much history is kept renderable
  3. Lazy rendering on scroll - Load and render older messages on demand when the user scrolls up, rather than discarding them

Environment

  • Claude Code v2.1.51
  • Terminal: Ghostty (also reproducible in iTerm2, Terminal.app)
  • OS: macOS

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions