From cd86a49ea497d1bbb8aef41ddf39d7cd7b0006bb Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Wed, 8 Apr 2026 21:45:27 -0700 Subject: [PATCH] feat(cli): run setup commands in right-side split pane (#409) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: run setup script in split pane so main terminal stays interactive (#381) Instead of running the worktree setup script in the main terminal pane (blocking user interaction), queue a setup-split signal that TerminalPane consumes on mount — creating the initial pane clean, then splitting right and injecting the command into the new pane's PTY. * fix: address review findings * fix(terminal): run context menu Close Pane through request-close lifecycle --- .../src/components/terminal-pane/TerminalPane.tsx | 4 ++-- .../terminal-pane/use-terminal-pane-context-menu.ts | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/renderer/src/components/terminal-pane/TerminalPane.tsx b/src/renderer/src/components/terminal-pane/TerminalPane.tsx index 5031832ee86..bfd55b0922a 100644 --- a/src/renderer/src/components/terminal-pane/TerminalPane.tsx +++ b/src/renderer/src/components/terminal-pane/TerminalPane.tsx @@ -503,8 +503,8 @@ export default function TerminalPane({ const contextMenu = useTerminalPaneContextMenu({ managerRef, toggleExpandPane, - onSetTitle: handleStartRename, - tabId + onRequestClosePane: handleRequestClosePane, + onSetTitle: handleStartRename }) const effectiveAppearance = settings diff --git a/src/renderer/src/components/terminal-pane/use-terminal-pane-context-menu.ts b/src/renderer/src/components/terminal-pane/use-terminal-pane-context-menu.ts index e06c90e3fef..f3a2400eafe 100644 --- a/src/renderer/src/components/terminal-pane/use-terminal-pane-context-menu.ts +++ b/src/renderer/src/components/terminal-pane/use-terminal-pane-context-menu.ts @@ -1,14 +1,13 @@ import { useEffect, useRef, useState } from 'react' import type { ManagedPane, PaneManager } from '@/lib/pane-manager/pane-manager' -import { useAppStore } from '@/store' const CLOSE_ALL_CONTEXT_MENUS_EVENT = 'orca-close-all-context-menus' type UseTerminalPaneContextMenuDeps = { managerRef: React.RefObject toggleExpandPane: (paneId: number) => void + onRequestClosePane: (paneId: number) => void onSetTitle: (paneId: number) => void - tabId: string } type TerminalMenuState = { @@ -32,8 +31,8 @@ type TerminalMenuState = { export function useTerminalPaneContextMenu({ managerRef, toggleExpandPane, - onSetTitle, - tabId + onRequestClosePane, + onSetTitle }: UseTerminalPaneContextMenuDeps): TerminalMenuState { const contextPaneIdRef = useRef(null) const menuOpenedAtRef = useRef(0) @@ -105,10 +104,7 @@ export function useTerminalPaneContextMenu({ const onClosePane = (): void => { const pane = resolveMenuPane() if (pane && (managerRef.current?.getPanes().length ?? 0) > 1) { - // Why: clear the cache timer for this pane before closing, so the sidebar - // doesn't show a stale countdown for a pane that no longer exists. - useAppStore.getState().setCacheTimerStartedAt(`${tabId}:${pane.id}`, null) - managerRef.current?.closePane(pane.id) + onRequestClosePane(pane.id) } }