From 83e7dd860209ac3f0ccfa40ba98f7c314fa2b186 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Sat, 3 Jul 2021 12:30:13 +0900 Subject: fix: Temporary fix for #402 --- helix-term/src/application.rs | 6 +++++- helix-term/src/job.rs | 14 +++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 9622ad91..17ba2652 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -160,7 +160,11 @@ impl Application { } self.render(); } - Some(callback) = self.jobs.next_job() => { + Some(callback) = self.jobs.futures.next() => { + self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback); + self.render(); + } + Some(callback) = self.jobs.wait_futures.next() => { self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback); self.render(); } diff --git a/helix-term/src/job.rs b/helix-term/src/job.rs index c2873513..2ac41926 100644 --- a/helix-term/src/job.rs +++ b/helix-term/src/job.rs @@ -16,9 +16,9 @@ pub struct Job { #[derive(Default)] pub struct Jobs { - futures: FuturesUnordered, + pub futures: FuturesUnordered, /// These are the ones that need to complete before we exit. - wait_futures: FuturesUnordered, + pub wait_futures: FuturesUnordered, } impl Job { @@ -77,11 +77,11 @@ impl Jobs { } } - pub fn next_job( - &mut self, - ) -> impl Future>>> + '_ { - future::select(self.futures.next(), self.wait_futures.next()) - .map(|either| either.factor_first().0) + pub async fn next_job(&mut self) -> Option>> { + tokio::select! { + event = self.futures.next() => { event } + event = self.wait_futures.next() => { event } + } } pub fn add(&mut self, j: Job) { -- cgit v1.2.3-70-g09d2