mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 15:44:31 +03:00
Merge pull request #1889 from zed-industries/terminal-bugs
Refactored rendering to squash all wakeups into 1
This commit is contained in:
commit
0dcdd6ea39
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user