Files
dev/docs/tui-alternate-screen.md
zeekay 901a81abe9 docs: describe this product, and only what it can do
The docs read as OpenAI's Codex CLI: a getting-started page titled for it,
`codex --enable skills` and `code sandbox macos` for commands that do not
exist, defaults given as gpt-5.1-codex-max/openai when they are
zen5-coder/hanzo, a Homebrew page describing a formula we do not publish.

Removed three tui-stream-chunking notes and the execpolicy page: they
document modules and a subcommand that live only in the vendored upstream
copy. There is no execpolicy subcommand and no .codexpolicy loader in
code-rs; the page told users to run something the binary does not have.

Rewrote tui-alternate-screen against the source. It described an
auto/always/never enum and a --no-alt-screen flag; the shipped behavior is a
tui.alternate_screen bool with Ctrl+T, which replays the transcript into
scrollback on the way out — a better answer to Zellij than the one written
down. Genuine openai-provider documentation stays.
2026-08-07 21:51:19 -07:00

1.8 KiB

TUI alternate screen and terminal multiplexers

The conflict

The TUI draws into the terminal's alternate screen buffer, which gives it the whole viewport and leaves your scrollback untouched when it exits — the same thing vim and less do.

The xterm specification says an alternate screen buffer has no scrollback, and Zellij follows that strictly and offers no setting to relax it. So inside Zellij the terminal's own scroll keys do nothing while the TUI is in alternate screen: the scrollback the multiplexer would show simply does not exist. This is the specification working as written, not a bug in either program. tmux and screen are laxer and usually scroll anyway.

What Hanzo Dev does about it

Ctrl+T toggles between the two buffers at any time.

Leaving the alternate screen replays the entire transcript into the normal buffer, so the conversation lands in real terminal scrollback and your multiplexer can page through it. Returning repaints the fullscreen view.

The choice is remembered: each toggle writes tui.alternate_screen to config.toml, and that value decides which buffer the next session starts in. Set it directly to pick a default:

[tui]
alternate_screen = false   # start in the normal buffer

Where this lives

What Where
Toggle behavior code-rs/tui/src/app/terminal.rs toggle_screen_mode()
Buffer switching code-rs/tui/src/tui.rs enter_alt_screen_only() / leave_alt_screen_only()
Startup buffer code-rs/tui/src/app/init.rs
Persisting the choice code_core::config::set_tui_alternate_screen()

If a crash leaves the terminal wrong

reset

Background

The scrollback problem was first reported against the upstream project in openai/codex#2558.