Skip to content

[codex] fix(tui): tolerate unsupported bracketed paste#3548

Merged
Hmbown merged 2 commits into
Hmbown:mainfrom
nightt5879:nightt5879/fix-1102-bracketed-paste
Jun 24, 2026
Merged

[codex] fix(tui): tolerate unsupported bracketed paste#3548
Hmbown merged 2 commits into
Hmbown:mainfrom
nightt5879:nightt5879/fix-1102-bracketed-paste

Conversation

@nightt5879

Copy link
Copy Markdown
Contributor

Summary

  • Disable bracketed paste automatically for unmarked legacy Windows console hosts.
  • Make bracketed-paste enable/disable best-effort in TUI terminal recovery, pause, cleanup, and emergency restore paths.
  • Update the terminal quirk report and add regression coverage for the Windows conhost fallback and optional terminal-mode failures.

Root cause

Win10/LTSC legacy console hosts can report crossterm bracketed paste as unsupported (Bracketed paste not implemented in the legacy Windows API). CodeWhale already recovered some terminal modes best-effort, but bracketed paste still had strict paths and the legacy-host settings fallback did not disable it by default.

Closes #1102.

Testing

  • cargo fmt -- --check
  • cargo test -p codewhale-tui --bin codewhale-tui --locked unmarked_windows_console_forces_calm_rendering
  • cargo test -p codewhale-tui --bin codewhale-tui --locked recover_terminal_modes_runs_without_panic_on_windows
  • cargo test -p codewhale-tui --bin codewhale-tui --locked paste_burst_detection_is_configurable_independent_of_bracketed_paste
  • cargo test -p codewhale-tui --bin codewhale-tui --locked
  • cargo test --workspace --locked
  • cargo build --release -p codewhale-cli -p codewhale-tui --locked

Additional local check: cargo clippy --workspace --all-targets --locked -- -D warnings currently fails on unrelated current-main warnings in client/chat.rs, core/engine.rs, client.rs, tools/js_execution.rs, tools/pandoc.rs, tui/session_picker.rs, and tui/widgets/mod.rs; none are in this PR's changed files.

Legacy Windows console hosts can report bracketed paste as unsupported through crossterm, which made older Win10/LTSC shells a fragile startup and terminal-mode path.

Disable bracketed paste automatically for unmarked legacy Windows console hosts, and make bracketed-paste enable/disable best-effort in terminal recovery, pause, cleanup, and emergency restore paths.

Closes Hmbown#1102.

Verification:

- cargo fmt -- --check

- cargo test -p codewhale-tui --bin codewhale-tui --locked unmarked_windows_console_forces_calm_rendering

- cargo test -p codewhale-tui --bin codewhale-tui --locked recover_terminal_modes_runs_without_panic_on_windows

- cargo test -p codewhale-tui --bin codewhale-tui --locked paste_burst_detection_is_configurable_independent_of_bracketed_paste

- cargo test -p codewhale-tui --bin codewhale-tui --locked

- cargo test --workspace --locked

- cargo build --release -p codewhale-cli -p codewhale-tui --locked
@nightt5879 nightt5879 requested a review from Hmbown as a code owner June 24, 2026 09:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c0a0bb1412

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/tui/src/settings.rs Outdated
Codex review caught that mutating Settings::bracketed_paste inside apply_env_overrides could persist the legacy conhost fallback when unrelated settings are saved.

Keep the stored setting unchanged, expose an effective_bracketed_paste runtime helper, and use that helper when building TuiOptions for startup.

Verification:

- cargo fmt -- --check

- cargo test -p codewhale-tui --bin codewhale-tui --locked unmarked_windows_console_forces_calm_rendering

- cargo test -p codewhale-tui --bin codewhale-tui --locked recover_terminal_modes_runs_without_panic_on_windows

- cargo test -p codewhale-tui --bin codewhale-tui --locked paste_burst_detection_is_configurable_independent_of_bracketed_paste

- cargo test -p codewhale-tui --bin codewhale-tui --locked
@nightt5879

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: e99ab40265

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Hmbown Hmbown merged commit 11f83e2 into Hmbown:main Jun 24, 2026
10 checks passed
@nightt5879 nightt5879 deleted the nightt5879/fix-1102-bracketed-paste branch June 25, 2026 02:17
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.

Win10(LTSC)下无法打开TUI窗口

2 participants