on master help sign in
fix: Temporary fix for #402
83e7dd8Blaž Hrastnik
helix-term/src/application.rs+5−1
@@ -160,7 +160,11 @@ impl Application {
160 }
160 }
161 self.render();
161 self.render();
162 }
162 }
163− Some(callback) = self.jobs.next_job() => {
163+ Some(callback) = self.jobs.futures.next() => {
164+ self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback);
165+ self.render();
166+ }
167+ Some(callback) = self.jobs.wait_futures.next() => {
164 self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback);
168 self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback);
165 self.render();
169 self.render();
166 }
170 }
helix-term/src/job.rs+7−7
@@ -16,9 +16,9 @@ pub struct Job {
16
16
17#[derive(Default)]
17#[derive(Default)]
18pub struct Jobs {
18pub struct Jobs {
19− futures: FuturesUnordered<JobFuture>,
19+ pub futures: FuturesUnordered<JobFuture>,
20 /// These are the ones that need to complete before we exit.
20 /// These are the ones that need to complete before we exit.
21− wait_futures: FuturesUnordered<JobFuture>,
21+ pub wait_futures: FuturesUnordered<JobFuture>,
22}
22}
23
23
24impl Job {
24impl Job {
@@ -77,11 +77,11 @@ impl Jobs {
77 }
77 }
78 }
78 }
79
79
80− pub fn next_job(
81− &mut self,
82− ) -> impl Future<Output = Option<anyhow::Result<Option<Callback>>>> + '_ {
80+ pub async fn next_job(&mut self) -> Option<anyhow::Result<Option<Callback>>> {
81+ tokio::select! {
82+ event = self.futures.next() => { event }
83− future::select(self.futures.next(), self.wait_futures.next())
83+ event = self.wait_futures.next() => { event }
84− .map(|either| either.factor_first().0)
84+ }
85 }
85 }
86
86
87 pub fn add(&mut self, j: Job) {
87 pub fn add(&mut self, j: Job) {