Compare commits

...

1 Commits

Author SHA1 Message Date
Michael Bolin
20afce7105 fix: disable debouncing RequestRedraw in the TUI for now 2025-07-18 09:00:53 -07:00

View File

@@ -25,6 +25,13 @@ use std::sync::mpsc::channel;
use std::thread;
use std::time::Duration;
/// Debouncing is often a helpful performance optimization, though as shown in
/// https://github.com/openai/codex/pull/1610, it requires care to ensure that
/// it works well with interrupts via ctrl-C. For now, we favor correctness at
/// the cost of performance, but it would be worth revisiting this in the
/// future.
const DEBOUNCE_REDRAW_REQUESTS: bool = false;
/// Time window for debouncing redraw requests.
const REDRAW_DEBOUNCE: Duration = Duration::from_millis(10);
@@ -209,10 +216,14 @@ impl App<'_> {
while let Ok(event) = self.app_event_rx.recv() {
match event {
AppEvent::RequestRedraw => {
self.schedule_redraw();
if DEBOUNCE_REDRAW_REQUESTS {
self.schedule_redraw();
} else {
self.redraw_immediately(terminal)?;
}
}
AppEvent::Redraw => {
self.draw_next_frame(terminal)?;
self.redraw_immediately(terminal)?;
}
AppEvent::KeyEvent(key_event) => {
match key_event {
@@ -386,6 +397,10 @@ impl App<'_> {
}
}
fn redraw_immediately(&mut self, terminal: &mut tui::Tui) -> Result<()> {
self.draw_next_frame(terminal)
}
fn dispatch_paste_event(&mut self, pasted: String) {
match &mut self.app_state {
AppState::Chat { widget } => widget.handle_paste(pasted),