mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
fix(terminal): separate session choices from window actions (#5138)
Open the predefined session chooser directly on the installed shells and SSH. The plus button opens the default shell. Split commands live in the terminal tool window's Options menu, with Settings at the bottom of the session chooser. On the Windows fixture the chooser went from nine actions to six and from 267 px to 153 px in height.
This commit is contained in:
@@ -58,8 +58,8 @@ test("a narrow terminal panel keeps the selected tab's close button in view", as
|
||||
await expect(selected).toHaveAttribute("data-tooltip", new RegExp(longName));
|
||||
await expect(terminal.getByRole("button", { name: "Show Hidden Tabs" })).toBeHidden();
|
||||
await expect(terminal.getByRole("button", { name: "New Tab", exact: true })).toBeVisible();
|
||||
await terminal.getByRole("button", { name: "More Terminal Options" }).click();
|
||||
await expect(page.getByRole("menuitem", { name: /^New Terminal Tab/ })).toBeVisible();
|
||||
await terminal.getByRole("button", { name: "New Predefined Session" }).click();
|
||||
await expect(page.getByRole("menuitem", { name: "zsh", exact: true })).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
await strip.getByRole("button", { name: "Close Tab", exact: true }).click();
|
||||
await expect(terminal).toBeHidden();
|
||||
@@ -82,9 +82,32 @@ test("terminal split tabs fit when sessions overflow and switch through the menu
|
||||
await page.getByRole("menuitem", { name: "Local (2)", exact: true }).click();
|
||||
await expect(strip.getByRole("tab", { name: "Local (2)", selected: true })).toBeVisible();
|
||||
await expectSelectedTabToFit(strip);
|
||||
await expect(header.getByRole("button", { name: "More Terminal Options" })).toBeVisible();
|
||||
await expect(header.getByRole("button", { name: "New Predefined Session" })).toBeVisible();
|
||||
await hidden.click();
|
||||
await page.getByRole("menuitem", { name: longName, exact: true }).click();
|
||||
await expect(strip.getByRole("tab", { name: longName, selected: true })).toBeVisible();
|
||||
await expectSelectedTabToFit(strip);
|
||||
});
|
||||
|
||||
test("the terminal session chooser lists shells first and window options own the split commands", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
const terminal = await openTerminal(page, 520);
|
||||
const chooser = terminal.getByRole("button", { name: "New Predefined Session", exact: true });
|
||||
await expect(chooser).toBeVisible();
|
||||
await chooser.press("Space");
|
||||
const sessions = page.getByRole("menu", { name: "New Predefined Session", exact: true });
|
||||
await expect(sessions.getByRole("menuitem")).toHaveText(["zsh", "SSH Session…", /^Settings/]);
|
||||
await page.keyboard.press("Home");
|
||||
await expect(sessions.getByRole("menuitem", { name: "zsh", exact: true })).toBeFocused();
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(sessions).toBeHidden();
|
||||
await expect(terminal.getByRole("tab", { name: "zsh", selected: true })).toBeVisible();
|
||||
|
||||
await terminal.getByRole("button", { name: "Options", exact: true }).click();
|
||||
const options = page.getByRole("menu", { name: "Terminal options", exact: true });
|
||||
await expect(options.getByRole("menuitem", { name: /^Split Down/ })).toBeVisible();
|
||||
await expect(options.getByRole("menuitem", { name: /^Settings/ })).toBeVisible();
|
||||
await options.getByRole("menuitem", { name: /^Split Right/ }).click();
|
||||
await expect(terminal.getByRole("tablist", { name: "Terminal sessions" })).toHaveCount(2);
|
||||
});
|
||||
|
||||
@@ -427,16 +427,10 @@ function GroupTabs({ group }: { group: string }) {
|
||||
};
|
||||
|
||||
const renameTarget = renaming && tabs.find((t) => t.id === renaming.id);
|
||||
const moreItems: MenuItem[] = [
|
||||
{ kind: "action", action: "terminal.new" },
|
||||
{ kind: "separator" },
|
||||
{ kind: "header", label: "New Predefined Session" },
|
||||
const sessionItems: MenuItem[] = [
|
||||
...shellItems(shells),
|
||||
{ kind: "action", action: "ssh.startSession", label: "SSH Session…" },
|
||||
{ kind: "separator" },
|
||||
{ kind: "action", action: "terminal.splitRight" },
|
||||
{ kind: "action", action: "terminal.splitDown" },
|
||||
{ kind: "separator" },
|
||||
{ kind: "action", action: "file.settings", arg: "tools.terminal", label: "Settings", icon: "settings" },
|
||||
];
|
||||
|
||||
@@ -488,7 +482,7 @@ function GroupTabs({ group }: { group: string }) {
|
||||
ref={menuRef}
|
||||
icon="toolbar-expand"
|
||||
size="small"
|
||||
title="More Terminal Options"
|
||||
title="New Predefined Session"
|
||||
aria-haspopup="menu"
|
||||
aria-expanded={menuOpen}
|
||||
onClick={() => {
|
||||
@@ -499,7 +493,13 @@ function GroupTabs({ group }: { group: string }) {
|
||||
setMenuOpen((v) => !v);
|
||||
}}
|
||||
/>
|
||||
<Menu open={menuOpen} anchor={menuRef} items={moreItems} onClose={() => setMenuOpen(false)} />
|
||||
<Menu
|
||||
open={menuOpen}
|
||||
anchor={menuRef}
|
||||
items={sessionItems}
|
||||
aria-label={tx("New Predefined Session")}
|
||||
onClose={() => setMenuOpen(false)}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -124,6 +124,13 @@ export function activate(): () => void {
|
||||
order: 10,
|
||||
component: lazyComponent(() => loadTerminalRuntime().then((rt) => rt.TerminalView)),
|
||||
headerContent: lazyComponent(() => loadTerminalRuntime().then((rt) => rt.TerminalTabs)),
|
||||
plainTitle: true,
|
||||
headerMenu: [
|
||||
{ kind: "action", action: "terminal.splitRight" },
|
||||
{ kind: "action", action: "terminal.splitDown" },
|
||||
{ kind: "separator" },
|
||||
{ kind: "action", action: "file.settings", arg: "tools.terminal", label: "Settings", icon: "settings" },
|
||||
],
|
||||
}),
|
||||
// Terminal sessions moved to the editor (#2202): saved with the editor session, kept alive while hidden.
|
||||
registerEditorKind({
|
||||
|
||||
@@ -1241,7 +1241,6 @@
|
||||
"More Filters": "Más filtros",
|
||||
"More Actions": "Más acciones",
|
||||
"More Run/Debug": "Más de Ejecutar/Depurar",
|
||||
"More Terminal Options": "Más opciones de terminal",
|
||||
"More Tool Windows": "Más ventanas de herramientas",
|
||||
"Most recently opened tab": "Pestaña abierta más recientemente",
|
||||
"Mouse Control": "Control del mouse",
|
||||
|
||||
@@ -1176,7 +1176,6 @@
|
||||
"More Filters": "Plus de filtres",
|
||||
"More Actions": "Plus d'actions",
|
||||
"More Run/Debug": "Plus d'options d'exécution/débogage",
|
||||
"More Terminal Options": "Plus d'options du terminal",
|
||||
"More Tool Windows": "Plus de fenêtres d'outils",
|
||||
"Most recently opened tab": "Dernier onglet ouvert",
|
||||
"Mouse Control": "Contrôle à la souris",
|
||||
|
||||
@@ -1277,7 +1277,6 @@
|
||||
"More Filters": "필터 더 보기",
|
||||
"More Actions": "액션 더보기",
|
||||
"More Run/Debug": "그 외 실행/디버그",
|
||||
"More Terminal Options": "기타 터미널 옵션",
|
||||
"More Tool Windows": "도구 창 더보기",
|
||||
"Most recently opened tab": "가장 최근에 연 탭",
|
||||
"Mouse Control": "마우스 컨트롤",
|
||||
|
||||
@@ -1231,7 +1231,6 @@
|
||||
"More Filters": "Więcej filtrów",
|
||||
"More Actions": "Więcej akcji",
|
||||
"More Run/Debug": "Więcej opcji Uruchom/Debuguj",
|
||||
"More Terminal Options": "Więcej opcji terminala",
|
||||
"More Tool Windows": "Więcej okien narzędziowych",
|
||||
"Most recently opened tab": "Ostatnio otwarta karta",
|
||||
"Mouse Control": "Sterowanie myszą",
|
||||
|
||||
@@ -1231,7 +1231,6 @@
|
||||
"More Filters": "Mais filtros",
|
||||
"More Actions": "Mais ações",
|
||||
"More Run/Debug": "Mais opções de Executar/Depurar",
|
||||
"More Terminal Options": "Mais opções do terminal",
|
||||
"More Tool Windows": "Mais janelas de ferramentas",
|
||||
"Most recently opened tab": "Aba aberta mais recentemente",
|
||||
"Mouse Control": "Controle do mouse",
|
||||
|
||||
@@ -4021,7 +4021,6 @@
|
||||
"More Filters": "Diğer Filtreler",
|
||||
"More Actions": "Diğer Eylemler",
|
||||
"More Run/Debug": "Diğer Çalıştır/Hata Ayıkla Seçenekleri",
|
||||
"More Terminal Options": "Diğer Terminal Seçenekleri",
|
||||
"More Tool Windows": "Diğer Araç Pencereleri",
|
||||
"Most recently opened tab": "En son açılan sekme",
|
||||
"Mouse Control": "Fare Kontrolü",
|
||||
|
||||
@@ -1908,7 +1908,6 @@
|
||||
"More Filters": "更多篩選",
|
||||
"More Actions": "更多操作",
|
||||
"More Run/Debug": "更多執行/偵錯",
|
||||
"More Terminal Options": "更多終端機選項",
|
||||
"More Tool Windows": "更多工具視窗",
|
||||
"Most recently opened tab": "最近開啟的分頁",
|
||||
"Mouse Control": "滑鼠控制",
|
||||
|
||||
@@ -1962,7 +1962,6 @@
|
||||
"More Filters": "更多筛选",
|
||||
"More Actions": "更多操作",
|
||||
"More Run/Debug": "更多运行/调试",
|
||||
"More Terminal Options": "更多终端选项",
|
||||
"More Tool Windows": "更多工具窗口",
|
||||
"Most recently opened tab": "最近打开的标签页",
|
||||
"Mouse Control": "鼠标控制",
|
||||
|
||||
Reference in New Issue
Block a user