Skip to content

Commit

Permalink
fix: Temporary fix for #402
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed Jul 3, 2021
1 parent c68fe1f commit 83e7dd8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
6 changes: 5 additions & 1 deletion helix-term/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
14 changes: 7 additions & 7 deletions helix-term/src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ pub struct Job {

#[derive(Default)]
pub struct Jobs {
futures: FuturesUnordered<JobFuture>,
pub futures: FuturesUnordered<JobFuture>,
/// These are the ones that need to complete before we exit.
wait_futures: FuturesUnordered<JobFuture>,
pub wait_futures: FuturesUnordered<JobFuture>,
}

impl Job {
Expand Down Expand Up @@ -77,11 +77,11 @@ impl Jobs {
}
}

pub fn next_job(
&mut self,
) -> impl Future<Output = Option<anyhow::Result<Option<Callback>>>> + '_ {
future::select(self.futures.next(), self.wait_futures.next())
.map(|either| either.factor_first().0)
pub async fn next_job(&mut self) -> Option<anyhow::Result<Option<Callback>>> {
tokio::select! {
event = self.futures.next() => { event }
event = self.wait_futures.next() => { event }
}
}

pub fn add(&mut self, j: Job) {
Expand Down

0 comments on commit 83e7dd8

Please sign in to comment.