From 98f6dccd43f80ca79306efd4cf5409f5ebd31c87 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Thu, 7 Jul 2022 13:01:16 -0700 Subject: [PATCH] Fixed terminal clone on split --- crates/terminal/src/terminal.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index 57a78fbe78..4542e283ee 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -91,6 +91,7 @@ pub struct Terminal { has_new_content: bool, has_bell: bool, //Currently using iTerm bell, show bell emoji in tab until input is received cur_size: SizeInfo, + associated_directory: Option, } ///Upward flowing events, for changing the title and such @@ -126,7 +127,7 @@ impl Terminal { let pty_config = PtyConfig { shell: None, - working_directory, + working_directory: working_directory.clone(), hold: false, }; @@ -173,6 +174,7 @@ impl Terminal { has_new_content: false, has_bell: false, cur_size: size_info, + associated_directory: working_directory, } } @@ -410,6 +412,13 @@ impl Item for Terminal { .boxed() } + fn clone_on_split(&self, cx: &mut ViewContext) -> Option { + //From what I can tell, there's no way to tell the current working + //Directory of the terminal from outside the terminal. There might be + //solutions to this, but they are non-trivial and require more IPC + Some(Terminal::new(cx, self.associated_directory.clone())) + } + fn project_path(&self, _cx: &gpui::AppContext) -> Option { None }