Add "New Center Terminal" to context menu (#53702)

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Added "New Center Terminal" button to window context menu

"New Terminal" only opens a new terminal window in the dedicated
terminal view, while "New Center Terminal" opens a new terminal in the
currently active view.

"+"/"New..." context menu
<img width="487" height="318" alt="Screenshot_20260411_184840"
src="https://github.com/user-attachments/assets/7c1597cf-5638-4d76-a486-537033cb8da5"
/>

Right click context menu
<img width="422" height="386" alt="Screenshot_20260411_184904"
src="https://github.com/user-attachments/assets/4e557e21-8839-4226-b704-87e37fbd8f46"
/>
This commit is contained in:
Sven Vollmar authored and GitHub committed 2026-04-15 17:38:47 +00:00
1 parent 5cee9c5d63
commit 321d72397c
2 files changed
+11 -3

No files matched your search

@@ -507,6 +507,10 @@ impl TerminalView {
let context_menu = ContextMenu::build(window, cx, |menu, _, _| {
menu.context(self.focus_handle.clone())
.action("New Terminal", Box::new(NewTerminal::default()))
.action(
"New Center Terminal",
Box::new(NewCenterTerminal::default()),
)
.separator()
.action("Copy", Box::new(Copy))
.action("Paste", Box::new(Paste))
+7 -3
View File
@@ -1,7 +1,7 @@
use crate::{
CloseWindow, NewFile, NewTerminal, OpenInTerminal, OpenOptions, OpenTerminal, OpenVisible,
SplitDirection, ToggleFileFinder, ToggleProjectSymbols, ToggleZoom, Workspace,
WorkspaceItemBuilder, ZoomIn, ZoomOut,
CloseWindow, NewCenterTerminal, NewFile, NewTerminal, OpenInTerminal, OpenOptions,
OpenTerminal, OpenVisible, SplitDirection, ToggleFileFinder, ToggleProjectSymbols, ToggleZoom,
Workspace, WorkspaceItemBuilder, ZoomIn, ZoomOut,
focus_follows_mouse::FocusFollowsMouse as _,
invalid_item_view::InvalidItemView,
item::{
@@ -4199,6 +4199,10 @@ fn default_render_tab_bar_buttons(
.action("Search Symbols", ToggleProjectSymbols.boxed_clone())
.separator()
.action("New Terminal", NewTerminal::default().boxed_clone())
.action(
"New Center Terminal",
NewCenterTerminal::default().boxed_clone(),
)
}))
}),
)