aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/Cargo.toml11
-rw-r--r--helix-term/src/editor.rs27
-rw-r--r--helix-term/src/line.rs27
-rw-r--r--helix-term/src/test.rs28
4 files changed, 9 insertions, 84 deletions
diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml
index 3a8321aa..1cb2c3bc 100644
--- a/helix-term/Cargo.toml
+++ b/helix-term/Cargo.toml
@@ -17,12 +17,11 @@ path = "src/main.rs"
anyhow = "1.0.31"
argh = "0.1.3"
helix-core = { path = "../helix-core" }
-# crossterm = { version = "0.17.5", features = ["event-stream"] }
-crossterm = { git = "https://github.com/crossterm-rs/crossterm", branch = "mio-update", features = ["event-stream"] }
+crossterm = { version = "0.17.7", features = ["event-stream"] }
-futures = { version = "0.3.5", default-features = false, features = ["std"] }
+smol = "0.3"
+futures = { version = "0.3.5", default-features = false, features = ["std", "async-await"] }
# futures-timer = "3.0.2"
-smol = "0.1.10"
-num_cpus = "1.13.0"
-piper = "0.1.2"
+# async-channel = "1.4.0"
+
# tui = { version = "0.9.5", default-features = false }
diff --git a/helix-term/src/editor.rs b/helix-term/src/editor.rs
index 889eaa4c..11ae9695 100644
--- a/helix-term/src/editor.rs
+++ b/helix-term/src/editor.rs
@@ -144,35 +144,10 @@ impl Editor {
execute!(stdout, terminal::EnterAlternateScreen)?;
- use std::thread;
-
- // Same number of threads as there are CPU cores.
- let num_threads = num_cpus::get().max(1);
-
- // A channel that sends the shutdown signal.
- let (s, r) = piper::chan::<()>(0);
- let mut threads = Vec::new();
-
- // Create an executor thread pool.
- for _ in 0..num_threads {
- // Spawn an executor thread that waits for the shutdown signal.
- let r = r.clone();
- threads.push(thread::spawn(move || smol::run(r.recv())));
- }
-
- // No need to `run()`, now we can just block on the main future.
- smol::block_on(self.print_events());
-
- // Send a shutdown signal.
- drop(s);
+ smol::run(self.print_events());
execute!(stdout, terminal::LeaveAlternateScreen)?;
- // Wait for threads to finish.
- for t in threads {
- t.join().unwrap();
- }
-
disable_raw_mode()?;
Ok(())
diff --git a/helix-term/src/line.rs b/helix-term/src/line.rs
index 58d4c9d8..b4b88655 100644
--- a/helix-term/src/line.rs
+++ b/helix-term/src/line.rs
@@ -64,32 +64,7 @@ fn main() -> Result<()> {
let mut stdout = stdout();
execute!(stdout, EnableMouseCapture)?;
- use std::thread;
-
- // Same number of threads as there are CPU cores.
- let num_threads = num_cpus::get().max(1);
-
- // A channel that sends the shutdown signal.
- let (s, r) = piper::chan::<()>(0);
- let mut threads = Vec::new();
-
- // Create an executor thread pool.
- for _ in 0..num_threads {
- // Spawn an executor thread that waits for the shutdown signal.
- let r = r.clone();
- threads.push(thread::spawn(move || smol::run(r.recv())));
- }
-
- // No need to `run()`, now we can just block on the main future.
- smol::block_on(print_events());
-
- // Send a shutdown signal.
- drop(s);
-
- // Wait for threads to finish.
- for t in threads {
- t.join().unwrap();
- }
+ smol::run(print_events());
execute!(stdout, DisableMouseCapture)?;
diff --git a/helix-term/src/test.rs b/helix-term/src/test.rs
index 12b4f377..181a3ee0 100644
--- a/helix-term/src/test.rs
+++ b/helix-term/src/test.rs
@@ -42,7 +42,7 @@ async fn print_events() {
if event == Event::Key(KeyCode::Char('c').into()) {
println!("Cursor position: {:?}\r", position());
-
+
}
println!("test");
@@ -67,32 +67,8 @@ fn main() -> Result<()> {
let mut stdout = stdout();
execute!(stdout, EnableMouseCapture)?;
- use std::thread;
-
- // Same number of threads as there are CPU cores.
- let num_threads = num_cpus::get().max(1);
-
- // A channel that sends the shutdown signal.
- let (s, r) = piper::chan::<()>(0);
- let mut threads = Vec::new();
-
- // Create an executor thread pool.
- for _ in 0..num_threads {
- // Spawn an executor thread that waits for the shutdown signal.
- let r = r.clone();
- threads.push(thread::spawn(move || smol::run(r.recv())));
- }
-
// No need to `run()`, now we can just block on the main future.
- smol::block_on(print_events());
-
- // Send a shutdown signal.
- drop(s);
-
- // Wait for threads to finish.
- for t in threads {
- t.join().unwrap();
- }
+ smol::run(print_events());
execute!(stdout, DisableMouseCapture)?;