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.

Add a split button to terminal panes (#21251)

Kirill Bulatov34ed48e14bcf
diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs
index 38b2eda6769..4d8d197aea9 100644
--- a/crates/terminal_view/src/terminal_panel.rs
+++ b/crates/terminal_view/src/terminal_panel.rs
@@ -36,8 +36,8 @@ use workspace::{
move_item, pane,
ui::IconName,
ActivateNextPane, ActivatePane, ActivatePaneInDirection, ActivatePreviousPane, DraggedTab,
- ItemId, NewTerminal, Pane, PaneGroup, SplitDirection, SwapPaneInDirection, ToggleZoom,
- Workspace,
+ ItemId, NewTerminal, Pane, PaneGroup, SplitDirection, SplitDown, SplitLeft, SplitRight,
+ SplitUp, SwapPaneInDirection, ToggleZoom, Workspace,
};
use anyhow::Result;
@@ -166,6 +166,25 @@ impl TerminalPanel {
Some(menu)
}),
)
+ .child(
+ PopoverMenu::new("terminal-pane-tab-bar-split")
+ .trigger(
+ IconButton::new("terminal-pane-split", IconName::Split)
+ .icon_size(IconSize::Small)
+ .tooltip(|cx| Tooltip::text("Split Pane", cx)),
+ )
+ .anchor(AnchorCorner::TopRight)
+ .with_handle(pane.split_item_context_menu_handle.clone())
+ .menu(move |cx| {
+ ContextMenu::build(cx, |menu, _| {
+ menu.action("Split Right", SplitRight.boxed_clone())
+ .action("Split Left", SplitLeft.boxed_clone())
+ .action("Split Up", SplitUp.boxed_clone())
+ .action("Split Down", SplitDown.boxed_clone())
+ })
+ .into()
+ }),
+ )
.child({
let zoomed = pane.is_zoomed();
IconButton::new("toggle_zoom", IconName::Maximize)
diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs
index 69485846e9d..292f59eba8e 100644
--- a/crates/workspace/src/pane.rs
+++ b/crates/workspace/src/pane.rs
@@ -303,7 +303,7 @@ pub struct Pane {
double_click_dispatch_action: Box<dyn Action>,
save_modals_spawned: HashSet<EntityId>,
pub new_item_context_menu_handle: PopoverMenuHandle<ContextMenu>,
- split_item_context_menu_handle: PopoverMenuHandle<ContextMenu>,
+ pub split_item_context_menu_handle: PopoverMenuHandle<ContextMenu>,
pinned_tab_count: usize,
}