Skip to content

Commit

Permalink
Yet another attempt at helix-editor#402.
Browse files Browse the repository at this point in the history
  • Loading branch information
jneem committed Jul 6, 2021
1 parent 906cfd5 commit 8315a8a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 9 deletions.
28 changes: 28 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion helix-term/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ num_cpus = "1"
tui = { path = "../helix-tui", package = "helix-tui", default-features = false, features = ["crossterm"] }
crossterm = { version = "0.20", features = ["event-stream"] }

futures-util = { version = "0.3", features = ["std", "async-await"], default-features = false }
futures-util = { version = "0.3", features = ["std", "async-await", "async-await-macro"], default-features = false }

# Logging
fern = "0.6"
Expand Down
6 changes: 1 addition & 5 deletions helix-term/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,7 @@ impl Application {
last_render = Instant::now();
}
}
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() => {
Some(callback) = self.jobs.next_job() => {
self.jobs.handle_callback(&mut self.editor, &mut self.compositor, callback);
self.render();
}
Expand Down
9 changes: 6 additions & 3 deletions helix-term/src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ impl Jobs {
}

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 }
loop {
futures_util::select! {
event = self.futures.select_next_some() => { return Some(event); }
event = self.wait_futures.select_next_some() => { return Some(event); }
complete => { return None; }
};
}
}

Expand Down

0 comments on commit 8315a8a

Please sign in to comment.