on master help sign in
fix: Temporary fix for #402
commit83e7dd860209ac3f0ccfa40ba98f7c314fa2b186 authorBlaž Hrastnik <blaz@mxxn.io> dateSat 3 Jul 2021, 12:30 (5 years ago) parentc68fe1f
2 files changed+12−8
helix-term/src/application.rs+5−1 helix-term/src/job.rs+7−7
helix-term/src/application.rs+5−1
@@ -160,7 +160,11 @@ impl Application {
160160 }
161161 self.render();
162162 }
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() => {
164168 self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback);
165169 self.render();
166170 }
helix-term/src/job.rs+7−7
@@ -16,9 +16,9 @@ pub struct Job {
1616
1717#[derive(Default)]
1818pub struct Jobs {
19− futures: FuturesUnordered<JobFuture>,
19+ pub futures: FuturesUnordered<JobFuture>,
2020 /// These are the ones that need to complete before we exit.
21− wait_futures: FuturesUnordered<JobFuture>,
21+ pub wait_futures: FuturesUnordered<JobFuture>,
2222}
2323
2424impl Job {
@@ -77,11 +77,11 @@ impl Jobs {
7777 }
7878 }
7979
80− pub fn next_job(
81− &mut self,
82− ) -> impl Future<Output = Option<anyhow::Result<Option<Callback>>>> + '_ {
83− future::select(self.futures.next(), self.wait_futures.next())
84− .map(|either| either.factor_first().0)
80+ pub async fn next_job(&mut self) -> Option<anyhow::Result<Option<Callback>>> {
81+ tokio::select! {
82+ event = self.futures.next() => { event }
83+ event = self.wait_futures.next() => { event }
84+ }
8585 }
8686
8787 pub fn add(&mut self, j: Job) {