Add a split button to terminal panes (#21251)

Follow-up of https://github.com/zed-industries/zed/pull/21238

<img width="873" alt="image"
src="https://github.com/user-attachments/assets/8cf2d8ea-a1df-4a6a-95d6-5867e0ee287d">

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2024-11-27 23:17:44 +02:00 committed by GitHub
parent 0c8e5550e7
commit 34ed48e14b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 3 deletions

View file

@ -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)