Skip to content

[codex] refactor TUI to use native terminal scrollback - #161

Merged
lyfmt merged 58 commits into
devfrom
refactor/tui-inline-terminal-scrollback
Jul 17, 2026
Merged

[codex] refactor TUI to use native terminal scrollback#161
lyfmt merged 58 commits into
devfrom
refactor/tui-inline-terminal-scrollback

Conversation

@lyfmt

@lyfmt lyfmt commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Problem

The TUI previously combined the transcript, streaming output, input, overlays, and status into an alternate-screen full-frame renderer. This hid terminal-native scrollback and text selection, imposed an application-managed history window, and made resize, close, and streaming updates prone to duplicated or transient lines entering history.

Root cause

Stable transcript content and mutable terminal chrome shared the same rendering lifecycle. The renderer could not distinguish append-only history from redrawable state, while alternate-screen and mouse-tracking modes transferred scroll ownership from the terminal to the application.

Changes

  • Run the interactive TUI on the normal screen and return wheel, PageUp/PageDown, selection, and scrollback ownership to the terminal or tmux.
  • Split the transcript into a stable prefix and live tail, then commit each stable block once per session projection through a dedicated ledger.
  • Add cursor probing, inline viewport tracking, synchronized history insertion, and bounded mutable-surface diffing so streaming, input, overlays, and status remain redrawable without polluting scrollback.
  • Preserve committed history across resize and close, restore terminal modes on shutdown, and keep the startup banner as a one-time native-scrollback prelude.
  • Carry forward the prerequisite TUI reliability work for bounded tool progress, coalesced redraws, resume transcript projection, and provider fallback display.
  • Replace alternate-screen history tests with unit, render-pipeline, boundary, performance, and real PTY/tmux coverage for the inline protocol.
  • Update the project TUI skill with the new normal-screen invariants and regression entry points.

User impact

Long conversations remain available in terminal-native scrollback without a 500-line application cap. Streaming updates no longer leave intermediate copies behind, resize and exit preserve committed transcript, and standard terminal or tmux scrolling and selection work without TUI-specific history controls.

Validation

  • mvn -pl lypi-transport-tui -am test
    • lypi-contracts: 140 tests passed
    • lypi-transport-tui: 400 tests passed
  • Frame PTY coverage reached tui frame PTY passed before further smoke execution was stopped at user direction.

lyfmt added 30 commits July 14, 2026 20:26
lyfmt added 28 commits July 15, 2026 20:30
Probe the post-resize cursor to account for terminal line reflow, and preserve the shell cursor while resetting scroll regions on close.
@lyfmt
lyfmt marked this pull request as ready for review July 17, 2026 10:39
@lyfmt
lyfmt merged commit 9820867 into dev Jul 17, 2026
4 checks passed
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