Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Refactored rendering to squash all wakeups into 1
Mikayla Makia66aa9c09cc7
diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rsindex 473bbd4f52a..014eeecc0c7 100644--- a/crates/terminal/src/terminal.rs+++ b/crates/terminal/src/terminal.rs@@ -407,13 +407,18 @@ impl TerminalBuilder {'outer: loop {let mut events = vec![];let mut timer = cx.background().timer(Duration::from_millis(4)).fuse();-+ let mut wakeup = false;loop {futures::select_biased! {_ = timer => break,event = self.events_rx.next() => {if let Some(event) = event {- events.push(event);+ if matches!(event, AlacTermEvent::Wakeup) {+ wakeup = true;+ } else {+ events.push(event);+ }+if events.len() > 100 {break;}@@ -432,6 +437,9 @@ impl TerminalBuilder {for event in events {this.process_event(&event, cx);}+ if wakeup {+ this.process_event(&AlacTermEvent::Wakeup, cx);+ }});smol::future::yield_now().await;}