﻿---
title: "tmux 和 Zellij 要滚动回放：alternate_screen 写成 never"
summary: "默认 auto。现在 auto 在 Zellij 也会进备用屏。参考文档若还写跳过 Zellij，以运行时为准。"
category: config
level: starter
surfaces: [cli]
tags: ["TUI", "alternate_screen", "Zellij"]
canonical: /tips/tui-alternate-screen/
---

# tmux 和 Zellij 要滚动回放：alternate_screen 写成 never

默认 auto。现在 auto 在 Zellij 也会进备用屏。参考文档若还写跳过 Zellij，以运行时为准。

TUI 默认走备用屏（CSI 1049）。很多多路复用器在备用屏里不保留会话中的滚动回放，看起来像「输出一闪就没了」。要沿用终端自己的滚动历史，关掉备用屏：

```toml
[tui]
alternate_screen = "never"
```

一次性：

```bash
codex --no-alt-screen
codex -c tui.alternate_screen=never
```

取值是 `auto` | `always` | `never`，默认 `auto`。文件里如果已经有 `[tui]`，只在同一张表里加键，不要再贴第二份 `[tui]`。

过时博客陷阱：旧文和部分配置参考仍写「`auto` 会在 Zellij 里关掉备用屏」。`#22214` 已去掉这条 workaround，**现在 `auto` 对 Zellij 也走备用屏**。Zellij 0.44.1 起才按标准备用屏工作。还要在会话中用多路复用器回放，显式 `never` 或 `--no-alt-screen`。

这和 `/raw` 不是一回事：`/raw` 管 TUI 里划选复制；备用屏管的是终端/ Zellij / tmux 自己的滚动缓冲。改完必须新开会话。

## 来源

- [OpenAI · Configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference)
- [OpenAI · CLI 参考（中文）](https://developers.openai.ac.cn/codex/cli/reference)
- [openai/codex#22214](https://github.com/openai/codex/pull/22214)
