From 8ff2f01596b32c20483a619878d1cd7f38bf45a6 Mon Sep 17 00:00:00 2001 From: Jonathan Goren Date: Sun, 29 Jan 2023 10:02:16 +0200 Subject: [PATCH 1/2] Enable crossterm's `dev-tty` feature This fixes piping to Helix on macos. Also remove the error message preventing this usage. --- Cargo.lock | 12 ++++++++++++ helix-term/Cargo.toml | 2 +- helix-term/src/application.rs | 5 ----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5fd993c98213..cc2249e93e08 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -239,6 +239,7 @@ checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13" dependencies = [ "bitflags 1.3.2", "crossterm_winapi", + "filedescriptor", "futures-core", "libc", "mio", @@ -391,6 +392,17 @@ dependencies = [ "log", ] +[[package]] +name = "filedescriptor" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7199d965852c3bac31f779ef99cbb4537f80e952e2d6aa0ffeb30cce00f4f46e" +dependencies = [ + "libc", + "thiserror", + "winapi", +] + [[package]] name = "filetime" version = "0.2.21" diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index 55885a9f2d1d..97c42956d51d 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -37,7 +37,7 @@ which = "4.4" tokio = { version = "1", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot"] } tui = { path = "../helix-tui", package = "helix-tui", default-features = false, features = ["crossterm"] } -crossterm = { version = "0.26", features = ["event-stream"] } +crossterm = { version = "0.26", features = ["event-stream", "use-dev-tty"] } signal-hook = "0.3" tokio-stream = "0.1" futures-util = { version = "0.3", features = ["std", "async-await"], default-features = false } diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 7e9684827a9c..ea7409c8d8f7 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -215,11 +215,6 @@ impl Application { } } else if stdin().is_tty() || cfg!(feature = "integration") { editor.new_file(Action::VerticalSplit); - } else if cfg!(target_os = "macos") { - // On Linux and Windows, we allow the output of a command to be piped into the new buffer. - // This doesn't currently work on macOS because of the following issue: - // https://github.com/crossterm-rs/crossterm/issues/500 - anyhow::bail!("Piping into helix-term is currently not supported on macOS"); } else { editor .new_file_from_stdin(Action::VerticalSplit) From a51b8edcff47512799135cb2128b4a99af78cd8d Mon Sep 17 00:00:00 2001 From: Jonathan Goren Date: Wed, 12 Jul 2023 17:27:55 +0300 Subject: [PATCH 2/2] selectively enable crossterm/use-dev-tty --- helix-term/Cargo.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index 97c42956d51d..9cfe1d6edcee 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -37,7 +37,7 @@ which = "4.4" tokio = { version = "1", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot"] } tui = { path = "../helix-tui", package = "helix-tui", default-features = false, features = ["crossterm"] } -crossterm = { version = "0.26", features = ["event-stream", "use-dev-tty"] } +crossterm = { version = "0.26", features = ["event-stream"] } signal-hook = "0.3" tokio-stream = "0.1" futures-util = { version = "0.3", features = ["std", "async-await"], default-features = false } @@ -70,6 +70,9 @@ grep-searcher = "0.1.11" signal-hook-tokio = { version = "0.3", features = ["futures-v0_3"] } libc = "0.2.146" +[target.'cfg(target_os = "macos")'.dependencies] +crossterm = { version = "0.26", features = ["event-stream", "use-dev-tty"] } + [build-dependencies] helix-loader = { version = "0.6", path = "../helix-loader" }