Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Ensure `ctrl-`` works in the terminal panel

Antonio Scandurra641f5d1107b2
diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs
index 90072ea6528..d963025f89b 100644
--- a/crates/terminal_view/src/terminal_panel.rs
+++ b/crates/terminal_view/src/terminal_panel.rs
@@ -8,6 +8,10 @@ use settings::{Settings, WorkingDirectory};
use util::ResultExt;
use workspace::{dock::Panel, pane, DraggedItem, Pane, Workspace};
+pub fn init(cx: &mut AppContext) {
+ cx.add_action(TerminalPanel::add_terminal);
+}
+
pub enum Event {
Close,
}
@@ -47,7 +51,9 @@ impl TerminalPanel {
let this = this.clone();
cx.window_context().defer(move |cx| {
if let Some(this) = this.upgrade(cx) {
- this.update(cx, |this, cx| this.add_terminal(cx));
+ this.update(cx, |this, cx| {
+ this.add_terminal(&Default::default(), cx);
+ });
}
})
},
@@ -80,7 +86,7 @@ impl TerminalPanel {
}
}
- fn add_terminal(&mut self, cx: &mut ViewContext<Self>) {
+ fn add_terminal(&mut self, _: &workspace::NewTerminal, cx: &mut ViewContext<Self>) {
if let Some(workspace) = self.workspace.upgrade(cx) {
let working_directory_strategy = cx
.global::<Settings>()
@@ -123,7 +129,7 @@ impl View for TerminalPanel {
fn focus_in(&mut self, _: gpui::AnyViewHandle, cx: &mut ViewContext<Self>) {
if self.pane.read(cx).items_len() == 0 {
- self.add_terminal(cx)
+ self.add_terminal(&Default::default(), cx)
}
}
}
diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs
index e3a5153ef30..b318b572b56 100644
--- a/crates/terminal_view/src/terminal_view.rs
+++ b/crates/terminal_view/src/terminal_view.rs
@@ -64,6 +64,7 @@ actions!(
impl_actions!(terminal, [SendText, SendKeystroke]);
pub fn init(cx: &mut AppContext) {
+ terminal_panel::init(cx);
cx.add_action(TerminalView::deploy);
register_deserializable_item::<TerminalView>(cx);