@@ -6268,6 +6268,17 @@ export default function ChatView(props: ChatViewProps) {
62686268 terminalUiOpenByThreadRef . current [ activeThreadKey ] = current ;
62696269 } , [ activeThreadKey , focusComposer , terminalUiState . terminalOpen ] ) ;
62706270
6271+ const getShortcutContext = useCallback (
6272+ ( ) => ( {
6273+ terminalFocus : getTerminalFocusOwner ( ) !== null ,
6274+ terminalOpen : Boolean ( terminalUiState . terminalOpen ) ,
6275+ previewFocus : isPreviewFocused ( ) ,
6276+ previewOpen : previewPanelOpen ,
6277+ modelPickerOpen : composerRef . current ?. isModelPickerOpen ( ) ?? false ,
6278+ } ) ,
6279+ [ composerRef , previewPanelOpen , terminalUiState . terminalOpen ] ,
6280+ ) ;
6281+
62716282 useEffect ( ( ) => {
62726283 const handler = ( event : globalThis . KeyboardEvent ) => {
62736284 if ( preventRepeatedTerminalCloseShortcut ( event , keybindings ) ) {
@@ -6288,13 +6299,7 @@ export default function ChatView(props: ChatViewProps) {
62886299 if ( event . defaultPrevented && terminalFocusOwner === null ) {
62896300 return ;
62906301 }
6291- const shortcutContext = {
6292- terminalFocus : terminalFocusOwner !== null ,
6293- terminalOpen : Boolean ( terminalUiState . terminalOpen ) ,
6294- previewFocus : isPreviewFocused ( ) ,
6295- previewOpen : previewPanelOpen ,
6296- modelPickerOpen : composerRef . current ?. isModelPickerOpen ( ) ?? false ,
6297- } ;
6302+ const shortcutContext = getShortcutContext ( ) ;
62986303
62996304 if (
63006305 ! shortcutContext . terminalFocus &&
@@ -6540,7 +6545,7 @@ export default function ChatView(props: ChatViewProps) {
65406545 supportsSettlement ,
65416546 confirmAndUnpinThread ,
65426547 copyActiveThreadReference ,
6543- previewPanelOpen ,
6548+ getShortcutContext ,
65446549 toggleRightPanel ,
65456550 toggleRightPanelMaximized ,
65466551 toggleTerminalVisibility ,
@@ -8536,6 +8541,7 @@ export default function ChatView(props: ChatViewProps) {
85368541 // reader's feet. A link the agent wrote can open any other one here, and that one has to be
85378542 // checkable out like it is anywhere else.
85388543 < PullRequestDetailPanel
8544+ getShortcutContext = { getShortcutContext }
85398545 shortcutsEnabled = {
85408546 rightPanelOpen && activeRightPanelSurface ?. id === renderedRightPanelSurface . id
85418547 }
0 commit comments