Skip to content
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

[MVP] Integrated Terminal #4649

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andreytkachenko
Copy link
Contributor

@andreytkachenko andreytkachenko commented Nov 8, 2022

Minimal implementation of integrated terminal based on alacritty_terminal crate.
Checklist:

  • terminal rendering logic
  • minimal key handlers
  • async pty (used pty_process)
  • handle process terminate event
  • rendering glitches (suspect tab symbol wrong render)
  • close terminal and kill the process
  • config section in config.toml
  • render title
  • render cursor
  • mouse support
  • full keyboard support
  • scrolling
  • clipboard support

Also nice to have later:

  • split and tab layouting
  • ssh tty
  • text motions support

@@ -42,6 +43,7 @@ toml = "0.5"
log = "~0.4"

which = "4.2"
alacritty_terminal = "0.17.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this dependency only in the helix-vte crate, then re-export it via pub use alacritty_terminal there? That way it's not included several times

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't think helix-vte should know anything about alacritty_terminal. helix-vte it is about process PTY or SSH.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm okay. How about splitting helix-view/src/terminal.rs etc into a helix-terminal crate? I'd like to keep the least amount of code possible in helix-view so it's more separated from the rest of -view

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only concern is - the name (helix-terminal) is confusing with helix-term

@kirawi kirawi added A-helix-term Area: Helix term improvements S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 8, 2022
@the-mikedavis the-mikedavis linked an issue Nov 8, 2022 that may be closed by this pull request
@sigmaSd
Copy link
Contributor

sigmaSd commented Nov 9, 2022

Was wezterm https://github.com/wez/wezterm/tree/main/term considered ? The advantage is the number of protocols it implements It has sixel iterm2 and kitty support and even more stuff already implemented.

Nvim terminal is implementing kitty protocol progressively and helix itself supports it since its using crossterm

@archseer
Copy link
Member

archseer commented Nov 9, 2022

Good call, it should also be a bit more lightweight since you need to bring your own pty provider

@andreytkachenko
Copy link
Contributor Author

Was wezterm https://github.com/wez/wezterm/tree/main/term considered ? The advantage is the number of protocols it implements It has sixel iterm2 and kitty support and even more stuff already implemented.

Nvim terminal is implementing kitty protocol progressively and helix itself supports it since its using crossterm

Hi, yes sure, but I decided that pulling whole wezterm repo only for term crate is too heavy and using alacritty_terminal instead. Since they push the term crate into crates.io it would be nice to switch to it later.

impl Default for PtySpawnConfig {
fn default() -> Self {
Self {
command: "/usr/bin/zsh".to_string(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's pass this in and use editor.config.shell

/// Shell to use for shell commands. Defaults to ["cmd", "/C"] on Windows and ["sh", "-c"] otherwise.
pub shell: Vec<String>,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we shouldn't use that option, because by default it is just /bin/sh and that is good for simple cases like pipe through some program. But when we starting the terminal we usually would like to see default system shell program. For now I am setting it value from SHELL env variable, but later it would be better make some terminal section in main configuration file.

#[error("IO Error: {0}")]
IoError(#[from] std::io::Error),

#[error("Termina Not Found: {0}")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[error("Termina Not Found: {0}")]
#[error("Terminal Not Found: {0}")]

Totally benign typo - just happened to be reading through the code and spotted it.

@xJonathanLEI
Copy link
Contributor

FWIW Zellij uses wezterm.

@archseer
Copy link
Member

It actually also uses alacritty. https://github.com/zellij-org/zellij/search?q=alacritty https://github.com/zellij-org/zellij/search?q=wezterm

@kirawi kirawi added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 22, 2022
@kazimir-malevich
Copy link
Contributor

Is the consensus to include a built in terminal as opposed to a multiplexer? If so what needs to be done?

@xprnio
Copy link

xprnio commented Jul 8, 2023

Is the consensus to include a built in terminal as opposed to a multiplexer? If so what needs to be done?

Random question as an outsider - is there a difference to the end-user?
AFAIK if a terminal was included instead of a multiplexer, wouldn't you be able to start a multiplexer (eg. tmux) inside the terminal? And wouldn't including a multiplexer basically accomplish the same, but without requiring the user to do the multiplexer hop?

@archseer
Copy link
Member

archseer commented Jul 8, 2023

There is no difference in our case. A built-in in terminal would automatically be a multiplexer since we'd be multiplexing it in a view split

@kazimir-malevich
Copy link
Contributor

There has to be way to integrate the warp terminal with Helix. Can't we just split the windows and have keybindings to change focus?

@andreytkachenko
Copy link
Contributor Author

@kazimir-malevich I suspect it wouldn't be integrated due to license incompatibility

Warp (https://warp.dev) is currently closed-source.

@xprnio
Copy link

xprnio commented Jul 12, 2023

Not to mention it's (from the looks of it) MacOS-only

(removed the @ as to not ping people for this irrelevant comment)

kazimir-malevich I suspect it wouldn't be integrated due to license incompatibility

Warp (https://warp.dev) is currently closed-source.

@nyabinary
Copy link

What's the status on this PR?

@xJonathanLEI
Copy link
Contributor

The status is Open.

@andreytkachenko
Copy link
Contributor Author

What's the status on this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Proposal] Buitin support for Integrated Terminal
9 participants