From 36912ce3de1c039f7faaddd509d0465ff644e6c1 Mon Sep 17 00:00:00 2001 From: Felipe Coury Date: Mon, 4 May 2026 17:39:11 -0300 Subject: [PATCH] fix(tui): use shared paste burst interval on Windows (#18914) ## Summary Fixes #11678 by removing the Windows-specific `PASTE_BURST_CHAR_INTERVAL` override. Windows now uses the same `8ms` paste-burst character interval as macOS and Linux, which removes the extra per-character hold that made fast typing and key repeat feel delayed on Windows. The paste-burst heuristic itself is unchanged, and the Windows-specific active idle timeout remains in place. This PR only restores the shared character-to-character burst threshold that decides whether adjacent plain character events are part of a paste. ## Motivation PR #9348 raised the Windows character interval from `8ms` to `30ms` to protect the multiline paste behavior tracked in #2137, where pasted newlines could be interpreted as submits in Windows terminals. That fixed the paste failure, but it also made ordinary typing visibly laggy because the TUI waits briefly before flushing a single typed character while it checks whether a paste burst is forming. The deployed behavior here is to remove that Windows-only delay and return to the cross-platform threshold. Manual Windows validation of the critical VS Code integrated terminal path shows multiline paste still works with the final `8ms` value, including testing on VS Code `1.107.0`. ## Testing - `cargo test -p codex-tui` - Manual Windows validation in VS Code integrated PowerShell with the final `8ms` interval --- codex-rs/tui/src/bottom_pane/paste_burst.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/codex-rs/tui/src/bottom_pane/paste_burst.rs b/codex-rs/tui/src/bottom_pane/paste_burst.rs index 510294a5f1..44e3898db6 100644 --- a/codex-rs/tui/src/bottom_pane/paste_burst.rs +++ b/codex-rs/tui/src/bottom_pane/paste_burst.rs @@ -154,12 +154,7 @@ const PASTE_BURST_MIN_CHARS: u16 = 3; const PASTE_ENTER_SUPPRESS_WINDOW: Duration = Duration::from_millis(120); // Maximum delay between consecutive chars to be considered part of a paste burst. -// Windows terminals (especially VS Code integrated terminal) deliver paste events -// more slowly than native terminals, so we use a higher threshold there. -#[cfg(not(windows))] const PASTE_BURST_CHAR_INTERVAL: Duration = Duration::from_millis(8); -#[cfg(windows)] -const PASTE_BURST_CHAR_INTERVAL: Duration = Duration::from_millis(30); // Idle timeout before flushing buffered paste content. // Slower paste bursts have been observed in Windows environments.