mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-27 04:44:30 +00:00
Begin work to dynamically add terminal names to menu
This commit is contained in:
parent
caa6a75238
commit
c80942ea00
1 changed files with 16 additions and 6 deletions
|
@ -113,13 +113,23 @@ impl TerminalButton {
|
||||||
_action: &DeployTerminalMenu,
|
_action: &DeployTerminalMenu,
|
||||||
cx: &mut ViewContext<Self>,
|
cx: &mut ViewContext<Self>,
|
||||||
) {
|
) {
|
||||||
|
let mut menu_options = vec![ContextMenuItem::item("New Terminal", NewTerminal)];
|
||||||
|
|
||||||
|
if let Some(workspace) = self.workspace.upgrade(cx) {
|
||||||
|
let project = workspace.read(cx).project().read(cx);
|
||||||
|
let local_terminal_handles = project.local_terminal_handles();
|
||||||
|
|
||||||
|
for local_terminal_handle in local_terminal_handles {
|
||||||
|
if let Some(_) = local_terminal_handle.upgrade(cx) {
|
||||||
|
// TODO: Obtain the actual terminal "name" and put it in the menu
|
||||||
|
// TODO: Replace the `NewTerminal` action with an action that instead focuses the selected terminal
|
||||||
|
menu_options.push(ContextMenuItem::item("Terminal", NewTerminal))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.popup_menu.update(cx, |menu, cx| {
|
self.popup_menu.update(cx, |menu, cx| {
|
||||||
menu.show(
|
menu.show(vec2f(0., 0.), AnchorCorner::TopLeft, menu_options, cx);
|
||||||
vec2f(0., 0.),
|
|
||||||
AnchorCorner::TopLeft,
|
|
||||||
vec![ContextMenuItem::item("New Terminal", NewTerminal)],
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue