From 1d4463ba8137b8ca3ea48ce08418ff2c4538d2c7 Mon Sep 17 00:00:00 2001 From: Josh McKinney Date: Fri, 19 Dec 2025 12:19:01 -0800 Subject: [PATCH] feat(tui2): coalesce transcript scroll redraws (#8295) Problem - Mouse wheel events were scheduling a redraw on every event, which could backlog and create lag during fast scrolling. Solution - Schedule transcript scroll redraws with a short delay (16ms) so the frame requester coalesces bursts into fewer draws. Why - Smooths rapid wheel scrolling while keeping the UI responsive. Testing - Manual: Scrolled in iTerm and Ghostty; no lag observed. - `cargo clippy --fix --all-features --tests --allow-dirty --allow-no-vcs -p codex-tui2` --- codex-rs/tui2/src/app.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/codex-rs/tui2/src/app.rs b/codex-rs/tui2/src/app.rs index a241cc879..0d4ea815e 100644 --- a/codex-rs/tui2/src/app.rs +++ b/codex-rs/tui2/src/app.rs @@ -953,7 +953,9 @@ impl App { self.transcript_scroll .scrolled_by(delta_lines, &line_meta, visible_lines); - tui.frame_requester().schedule_frame(); + // Delay redraws slightly so scroll bursts coalesce into a single frame. + tui.frame_requester() + .schedule_frame_in(Duration::from_millis(16)); } /// Convert a `ToBottom` (auto-follow) scroll state into a fixed anchor at the current view.