Skip to content

Refresh the Codex TUI palette when the terminal theme changes - #1

Open
ShuoRaa wants to merge 1 commit into
mainfrom
fix/live-terminal-palette
Open

ShuoRaa wants to merge 1 commit into
mainfrom
fix/live-terminal-palette

Conversation

@ShuoRaa

@ShuoRaa ShuoRaa commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

What changes

Keep the existing tint behind the composer and refresh it when the terminal's default foreground and background change during a Codex session. This addresses the Unix TUI behavior described in openai/codex#45163.

Read OSC 10/11 replies through the same input stream as keys and bracketed paste. Apply a complete color pair, invalidate cached rendering and redraw. Subscribe to terminal theme-change notifications when available. VS Code 1.138.0 reports mode 2031 as unsupported even though it answers color queries, so a focused terminal with that response checks again after two seconds. Focus loss cancels the timer. Input after a missing focus-gained report resumes checks.

Verification

Measured the composer cell in actual macOS VS Code integrated terminal sessions. Each session kept the same draft while switching themes.

Build Dark Modern Light Modern Dark Modern again
Installed Codex CLI 0.172.0 #333333 #333333 #333333
This branch, full CLI #333333 #EEEEEE #333333

The draft progressed from theme-checkA to theme-checkAB to theme-checkABC. The new PTY cases exercise notification and focus-triggered refresh, the focused fallback, and mixed key, paste and palette input.

Passed on macOS with the locked Cargo dependencies:

  • cargo build --locked -p codex-cli -p codex-tui --bin codex --bin codex-tui
  • cargo test --locked -p codex-tui --test all focus_palette -- --test-threads=1 (15 passed)
  • cargo test --locked -p codex-tui --lib tui::event_stream (11 passed)

The separate Bazel build stopped during the download of the aws-lc archive, so Bazel verification is still pending.

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