Skip to content

Commit 4002219

Browse files
committed
Add a toggleable integrated terminal
This commit adds the `helix-integrated-terminal` crate, which handles the PTY creation and view logic for an integrated terminal in Helix, using the `alacritty_terminal` crate. The terminal can be opened using the `:term` command, and the terminal can be exited by either using `exit` in the terminal itself, or by using `C-q` twice. The current implementation is as a pop-up, but in the future, we may be able to expose the terminal as a `View`, if work is done to decouple the `Document` attachment to `View`. Signed-off-by: Ryan Brue <[email protected]>
1 parent 456ea31 commit 4002219

File tree

20 files changed

+1446
-14
lines changed

20 files changed

+1446
-14
lines changed

Cargo.lock

Lines changed: 199 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ members = [
44
"helix-core",
55
"helix-graphics",
66
"helix-input",
7+
"helix-terminal-view",
78
"helix-view",
89
"helix-term",
910
"helix-tui",

helix-term/src/application.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,12 @@ impl Application {
678678
return true;
679679
}
680680
}
681+
EditorEvent::TerminalEvent(event) => {
682+
let needs_render = self.editor.handle_virtual_terminal_events(event).await;
683+
if needs_render {
684+
self.render().await;
685+
}
686+
}
681687
}
682688

683689
false

helix-term/src/commands.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ pub(crate) mod dap;
22
pub(crate) mod lsp;
33
pub(crate) mod syntax;
44
pub(crate) mod typed;
5+
pub(crate) mod vte;
56

67
pub use dap::*;
78
use futures_util::FutureExt;
@@ -18,6 +19,7 @@ use tui::{
1819
widgets::Cell,
1920
};
2021
pub use typed::*;
22+
pub use vte::*;
2123

2224
use helix_core::{
2325
char_idx_at_visual_offset,
@@ -616,6 +618,8 @@ impl MappableCommand {
616618
goto_prev_tabstop, "Goto next snippet placeholder",
617619
rotate_selections_first, "Make the first selection your primary one",
618620
rotate_selections_last, "Make the last selection your primary one",
621+
toggle_terminal, "Toggle integrated terminal",
622+
close_terminal, "Close active terminal",
619623
);
620624
}
621625

helix-term/src/commands/lsp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1402,7 +1402,7 @@ fn compute_inlay_hints_for_view(
14021402
};
14031403

14041404
let width = label.width();
1405-
let limit = limit.get().into();
1405+
let limit: usize = limit.get().into();
14061406
if width > limit {
14071407
let mut floor_boundary = 0;
14081408
let mut acc = 0;

0 commit comments

Comments
 (0)