-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow piping from stdin into a buffer on startup #996
Conversation
helix-view/src/editor.rs
Outdated
@@ -311,7 +313,13 @@ impl Editor { | |||
pub fn new_file(&mut self, action: Action) -> DocumentId { | |||
let id = DocumentId(self.next_document_id); | |||
self.next_document_id += 1; | |||
let mut doc = Document::default(); | |||
let mut doc = if stdin().is_tty() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want it to be in this function, I think it would make more sense for it to be in helix-term/src/application.rs::Application::new()
It did make me think of potentially opening new files that were piped from an application via :n "<shell stuff>"
as a shortcut to creating a new file and directly piping it like that. @archseer
I tested this on Linux, Windows, and macOS. It works on Linux and Windows, but unfortunately not on macOS. It might be a bug in Here's the panic message:
|
Looks like there's an open issue for the macOS problem I'm seeing. |
Conditionally disabling on MacOS might make sense right now. |
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Allow piping from stdin into a buffer on startup * Refactor * Don't allow piping into new buffer on macOS * Update helix-term/src/application.rs Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> * Update helix-term/src/application.rs Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> * Fix Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Closes #927