diff --git a/codex-rs/tui/src/app/owned_transcript_input_tests.rs b/codex-rs/tui/src/app/owned_transcript_input_tests.rs index 1488dc82e0..daca6bf9fa 100644 --- a/codex-rs/tui/src/app/owned_transcript_input_tests.rs +++ b/codex-rs/tui/src/app/owned_transcript_input_tests.rs @@ -886,8 +886,7 @@ async fn raw_multiline_paste_defers_rendering_and_submits_once() -> Result<()> { let during_paste = screen(&tui); // Wait out Windows' active-paste timeout and accidental-Enter suppression window. tokio::time::advance(Duration::from_secs(/*secs*/ 1)).await; - app.handle_tui_event(&mut tui, &mut server, TuiEvent::Draw) - .await?; + // The draw that flushes the paste should also display it. app.handle_tui_event(&mut tui, &mut server, TuiEvent::Draw) .await?; assert!(screen(&tui).contains("After paste")); diff --git a/codex-rs/tui/src/chatwidget/interaction.rs b/codex-rs/tui/src/chatwidget/interaction.rs index 1968b2e648..3042fae263 100644 --- a/codex-rs/tui/src/chatwidget/interaction.rs +++ b/codex-rs/tui/src/chatwidget/interaction.rs @@ -663,12 +663,9 @@ impl ChatWidget { fn finish_paste_burst_tick(&mut self, frame_requester: FrameRequester, flushed: bool) -> bool { if flushed { self.refresh_startup_recovery(); - // A paste just flushed; request an immediate redraw and skip this frame. - self.request_redraw(); - true - } else if self.is_in_paste_burst() { - // While capturing a burst, schedule a follow-up tick and skip this frame - // to avoid redundant renders between ticks. + } + // Paint the flushed input on this frame unless an editor is still buffering. + if self.is_in_paste_burst() { frame_requester.schedule_frame_in( crate::bottom_pane::ChatComposer::recommended_paste_flush_delay(), ); diff --git a/codex-rs/tui/src/startup_recovery_tests.rs b/codex-rs/tui/src/startup_recovery_tests.rs index 381dd7bcab..ce9ed4b500 100644 --- a/codex-rs/tui/src/startup_recovery_tests.rs +++ b/codex-rs/tui/src/startup_recovery_tests.rs @@ -70,7 +70,10 @@ async fn recovery_after_handoff_preserves_pending_vim_replace_key() { insta::assert_snapshot!(take_unsent_text().unwrap(), @"Xbcd"); assert_eq!(chat.composer_text_with_pending(), "abcd"); tokio::time::advance(std::time::Duration::from_millis(100)).await; - assert!(chat.handle_paste_burst_tick(crate::tui::FrameRequester::test_dummy())); + assert!( + !chat.handle_paste_burst_tick(crate::tui::FrameRequester::test_dummy()), + "the draw that commits the replacement key should render it" + ); assert_eq!(chat.composer_text_with_pending(), "Xbcd"); }) .await;