Merge pull request #1889 from zed-industries/terminal-bugs

Refactored rendering to squash all wakeups into 1
This commit is contained in:
Mikayla Maki 2022-11-14 10:29:00 -08:00 committed by GitHub
commit 0dcdd6ea39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}