Skip to content

tmux 分屏下联动滚动导致分隔线消失(inline 重绘) #43

@ARCJ137442

Description

@ARCJ137442

Summary

在 tmux 左右分栏时,Codex 在一侧刷新消息会把另一侧内容和纵向分隔线一起“下拉”,导致分隔线消失、另一侧行距被拉大。单 pane 或非 tmux 环境不明显。

Repro Steps

  1. 启动 tmux,创建左右分栏。
  2. 在左右两侧各运行 Codex(建议使用 inline 模式,例如 codex --no-alt-screentui.alternate_screen=never)。
  3. 右侧输入一条会产生多行输出的消息(如“你是谁”),等待渲染完成。

Expected

仅右侧 pane 更新,tmux 纵向分隔线保持稳定,左侧内容不移动。

Actual

右侧更新时,左侧内容被整体向下拉,纵向分隔线消失,视觉上像整屏滚动了一段。

Environment

  • Termux/Android + tmux(用户实际环境)
  • Codex 0.114.0-exomind

Analysis / Hypothesis

Codex TUI 在 inline 模式下会使用 ratatui 的 scrolling-regions 优化,依赖 “滚动区域 + CSI S(Scroll Up)” 来给历史行腾位置。具体路径:

  • tui::draw 在 viewport 超出屏幕时调用 scroll_region_up 来把上方内容滚动出空间:
    • codex-rs/tui/src/tui.rs L470-L500(scroll_region_up(0..area.top(), area.bottom() - size.height)
  • ratatui 在 scrolling-regions feature 下会发出 ESC[{top};{bottom}r + ESC[{n}S(设置滚动区域 + Scroll Up)
  • codex-rs/tui/Cargo.toml L66-L71 启用了 scrolling-regions

猜测 tmux 未完整处理/隔离这些滚动区域指令,导致它们被传递到外层终端,从而触发“整屏滚动”,把别的 pane 和分隔线一起拖动。这与观察到的分隔线消失、另一侧整体下移现象吻合。

Suggested Investigation

  • 记录 Codex 渲染期间发出的 ANSI 序列(例如 tmux pipe-panescript),确认是否包含 DECSTBM + CSI S
  • 在 tmux 下禁用 scrolling-regions(或运行时绕过 scroll_region_up)验证现象是否消失。

Possible Mitigations (Hypothesis)

  • Multiplexer::Tmux 时避免 scroll_region_up,退回到全量重绘路径。
  • 或在 tmux 下强制走 alt-screen(但会改变 scrollback 体验,需要权衡)。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions