Skip to content

tui: vendor vt100 with a scroll-region scrollback fix#373

Merged
edwin-zvs merged 1 commit into
mainfrom
fix-tui-scrollback-vt100-region
Jun 6, 2026
Merged

tui: vendor vt100 with a scroll-region scrollback fix#373
edwin-zvs merged 1 commit into
mainfrom
fix-tui-scrollback-vt100-region

Conversation

@edwin-zvs

Copy link
Copy Markdown
Contributor

Problem

Scrolling back a codex session in the TUI showed an empty/garbled history. Codex pins its input box with a top-anchored DECSTBM scroll region (ESC[1;Nr), and upstream vt100 0.16.2's Grid::scroll_up only saves scrolled-off lines to scrollback when no scroll region is active — so codex's entire conversation scrolled off into nothing (maxsb == 0). xterm / xterm.js (the web client) save whenever the region's top margin is row 0, which is why the webui never had this bug.

Fix

Vendor vt100 under vendor/vt100 (wired via [patch.crates-io]) with a one-line change to Grid::scroll_up: save the scrolled-off line whenever scroll_top == 0, matching xterm/xterm.js. No agentd code changes — the TUI's existing scrollback path now fills correctly.

Design rationale: specs/0017-pty-scrollback-is-real-terminal-history.md.

Why this, not the message log

An earlier attempt (#328, closed) rendered scroll-up from the structured Message stream. That dropped the tool calls / command output / diffs that make up most of a coding session — a net regression (main was better). This keeps the full, faithful terminal history.

Verification

  • codex scrollback: maxsb 0 → populated, clean and in order (was completely empty before).
  • claude (line-oriented, no region): unchanged — already populated scrollback.
  • 220 tests pass with the patched crate.

Binary

The patch affects the TUI's terminal emulation, so the relevant binary is agent. agentd / agentd-mcp / adapters rebuild against the patched crate but are behavior-unchanged.

The fork change is isolated to Grid::scroll_up and marked in-source as an agentd fork patch; worth upstreaming so the vendoring can eventually be dropped.

🤖 Generated with Claude Code

Codex pins its input box with a top-anchored DECSTBM scroll region
(ESC[1;Nr). Upstream vt100 0.16.2's Grid::scroll_up only pushes
scrolled-off lines to scrollback when no region is active, so codex's
entire conversation was dropped from scrollback and PTY scroll-up showed
nothing/garbled. xterm and xterm.js (the web client) save whenever the
region's top margin is row 0.

Vendor vt100 under vendor/vt100 and patch scroll_up to match
(scroll_top == 0) via [patch.crates-io]. No agentd code changes -- the
TUI's existing scrollback now fills correctly. Verified codex scrollback
goes from empty to populated; 220 tests pass.

See specs/0017-pty-scrollback-is-real-terminal-history.md.
@edwin-zvs
edwin-zvs force-pushed the fix-tui-scrollback-vt100-region branch from 6a2fe5b to 5dda545 Compare June 6, 2026 17:14
@edwin-zvs
edwin-zvs merged commit 88551c7 into main Jun 6, 2026
1 check passed
@edwin-zvs
edwin-zvs deleted the fix-tui-scrollback-vt100-region branch June 6, 2026 17:24
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