@@ -92,8 +92,7 @@ import { openTerminalLinkInPreview } from "./preview/openTerminalLinkInPreview"; |
92 | 92 | import { useAtomCommand } from "../state/use-atom-command"; |
93 | 93 | import { preventTerminalCloseShortcut } from "../lib/terminalCloseShortcut"; |
94 | 94 | import { observeResize } from "../lib/observeResize"; |
95 | | -import { selectActiveRightPanel, useRightPanelStore } from "../rightPanelStore"; |
96 | | -import { selectThreadTerminalUiState, useTerminalUiStateStore } from "../terminalUiStateStore"; |
| 95 | +import { threadShortcutContext } from "./Sidebar.logic"; |
97 | 96 | import { |
98 | 97 | consumePendingTerminalFocus, |
99 | 98 | focusTerminal, |
@@ -578,14 +577,7 @@ function TerminalSessionViewport({ |
578 | 577 | const hasHandledExitRef = useRef(false); |
579 | 578 | const selectionActionRequestIdRef = useRef(0); |
580 | 579 | const readKeybindings = useEffectEvent(() => keybindings); |
581 | | - const readThreadNavigationContext = useEffectEvent(() => ({ |
582 | | - terminalOpen: selectThreadTerminalUiState( |
583 | | - useTerminalUiStateStore.getState().terminalUiStateByThreadKey, |
584 | | - threadRef, |
585 | | - ).terminalOpen, |
586 | | - previewOpen: |
587 | | - selectActiveRightPanel(useRightPanelStore.getState().byThreadKey, threadRef) === "preview", |
588 | | - })); |
| 580 | + const readThreadShortcutContext = useEffectEvent(() => threadShortcutContext(threadRef)); |
589 | 581 | const handleSessionExited = useEffectEvent(() => { |
590 | 582 | if (hasTerminalWriteAccess()) onSessionExited(); |
591 | 583 | }); |
@@ -952,7 +944,7 @@ function TerminalSessionViewport({ |
952 | 944 | isDiffToggleShortcut(event, currentKeybindings, options) || |
953 | 945 | // Match Sidebar's context, or a key it will reject skips the shell. |
954 | 946 | isThreadNavigationShortcut(event, currentKeybindings, { |
955 | | - context: { ...options.context, ...readThreadNavigationContext() }, |
| 947 | + context: { ...readThreadShortcutContext(), terminalFocus: true }, |
956 | 948 | }) |
957 | 949 | ) { |
958 | 950 | return false; |
|