From 26fe7a81f34f69ec993f993eb1523dbe2d8cb480 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 9 May 2023 12:29:16 +0200 Subject: [PATCH] Prevent splits in the terminal panel --- crates/terminal_view/src/terminal_panel.rs | 1 + crates/workspace/src/pane.rs | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs index ce70f083911eb336cd9e41d9778398ffa3729e10..5b1a7d20dfff1c6beb5d28e382525dd9959e7b79 100644 --- a/crates/terminal_view/src/terminal_panel.rs +++ b/crates/terminal_view/src/terminal_panel.rs @@ -28,6 +28,7 @@ impl TerminalPanel { workspace.app_state().background_actions, cx, ); + pane.set_can_split(false, cx); pane.on_can_drop(move |drag_and_drop, cx| { drag_and_drop .currently_dragged::(window_id) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index c02c5d7ef4bc719ca7d602a9b8fe2681f794bdcf..fd617e1685d06bd1b9d9628620e283d7625fc1dd 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -149,6 +149,7 @@ pub struct Pane { workspace: WeakViewHandle, has_focus: bool, can_drop: Rc, &WindowContext) -> bool>, + can_split: bool, } pub struct ItemNavHistory { @@ -255,6 +256,7 @@ impl Pane { workspace, has_focus: false, can_drop: Rc::new(|_, _| true), + can_split: true, } } @@ -282,6 +284,11 @@ impl Pane { self.can_drop = Rc::new(can_drop); } + pub fn set_can_split(&mut self, can_split: bool, cx: &mut ViewContext) { + self.can_split = can_split; + cx.notify(); + } + pub fn nav_history_for_item(&self, item: &ViewHandle) -> ItemNavHistory { ItemNavHistory { history: self.nav_history.clone(), @@ -1563,8 +1570,8 @@ impl View for Pane { self, 0, self.active_item_index + 1, - false, - Some(100.), + !self.can_split, + if self.can_split { Some(100.) } else { None }, cx, { let toolbar = self.toolbar.clone();