diff options
author | Blaž Hrastnik | 2020-09-04 09:18:40 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2020-09-04 09:18:40 +0000 |
commit | 0d56ce9296ef6481b45cfdc90ea8b1d149ead242 (patch) | |
tree | fd08a114df4baee24c1994799541e8a2bfb2c449 /helix-term/src | |
parent | bfa753307063034abd86de5d9f99f5fe925504ca (diff) |
Bump deps, make it compile with latest smol.
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/editor.rs | 6 | ||||
-rw-r--r-- | helix-term/src/main.rs | 11 |
2 files changed, 13 insertions, 4 deletions
diff --git a/helix-term/src/editor.rs b/helix-term/src/editor.rs index a83db6fa..bddc2859 100644 --- a/helix-term/src/editor.rs +++ b/helix-term/src/editor.rs @@ -39,6 +39,8 @@ impl BufferComponent<'_> { } } +static EX: smol::Executor = smol::Executor::new(); + pub struct Editor { state: Option<State>, first_line: u16, @@ -134,14 +136,14 @@ impl Editor { } } - pub fn run(&mut self) -> Result<(), Error> { + pub async fn run(&mut self) -> Result<(), Error> { enable_raw_mode()?; let mut stdout = stdout(); execute!(stdout, terminal::EnterAlternateScreen)?; - smol::run(self.print_events()); + self.print_events().await; execute!(stdout, terminal::LeaveAlternateScreen)?; diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index 6e5ec5ff..7a9289ee 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -18,12 +18,19 @@ pub struct Args { files: Vec<PathBuf>, } +static EX: smol::Executor = smol::Executor::new(); + fn main() -> Result<(), Error> { let args: Args = argh::from_env(); println!("{:?}", args.files); - let mut editor = editor::Editor::new(args)?; - editor.run(); + for _ in 0..num_cpus::get() { + std::thread::spawn(move || smol::block_on(EX.run(smol::future::pending::<()>()))); + } + + smol::block_on(EX.run(async { + editor::Editor::new(args).unwrap().run().await; + })); Ok(()) } |