@@ -11,7 +11,7 @@ import { TerminalPanelProps } from '../../types/panelComponents';
1111import { isHotkeyEnabledForEvent , useHotkeyStore } from '../../stores/hotkeyStore' ;
1212import { renderLog , devLog } from '../../utils/console' ;
1313import { getTerminalTheme } from '../../utils/terminalTheme' ;
14- import { resolveTerminalKeyHandling } from '../../utils/terminalKeyHandling' ;
14+ import { resolveTerminalKeyHandling , shouldOpenTerminalSearch } from '../../utils/terminalKeyHandling' ;
1515import { isMac } from '../../utils/platformUtils' ;
1616import { FileEdit , FolderOpen } from 'lucide-react' ;
1717import { useTerminalLinks } from '../terminal/hooks/useTerminalLinks' ;
@@ -27,7 +27,7 @@ import { createAtTerminalHandler } from '../../services/terminalInterceptor/hand
2727import { InterceptorDropdown } from '../terminal/InterceptorDropdown' ;
2828import { InterceptorToast } from '../terminal/InterceptorToast' ;
2929import { usePanelStore } from '../../stores/panelStore' ;
30- import { useConfigStore } from '../../stores/configStore' ;
30+ import { areKeyboardShortcutsEnabled , useConfigStore } from '../../stores/configStore' ;
3131import type { InterceptorState , AtTerminalHandlerState , TerminalSuggestion } from '../../services/terminalInterceptor/types' ;
3232import '@xterm/xterm/css/xterm.css' ;
3333
@@ -41,7 +41,7 @@ const SKELETON_TRANSCRIPT_WIDTHS = ['w-2/3', 'w-1/2', 'w-5/6', 'w-1/3', 'w-3/4',
4141// lines, and a prompt box, swept by a single shimmer so it reads as one
4242// cohesive loading surface. Shown while initializing, refreshing, and CLI startup.
4343const TerminalLoadingSkeleton : React . FC = ( ) => (
44- < div className = "relative w-full h-full overflow-hidden px-4 py-4 font-mono select-none" aria-label = "Loading terminal" >
44+ < div className = "relative w-full h-full overflow-hidden px-4 py-4 font-mono select-none" role = "status" aria-label = "Loading terminal" >
4545 < div className = "flex h-full flex-col gap-4" >
4646 < div className = "rounded-md border border-border-primary p-3 space-y-2 max-w-md" >
4747 < div className = "h-3.5 w-40 rounded bg-surface-tertiary" />
@@ -233,6 +233,8 @@ export const TerminalPanel: React.FC<TerminalPanelProps> = React.memo(({ panel,
233233 const interceptorRef = useRef < TerminalInterceptor | null > ( null ) ;
234234 const skipNextInterceptRef = useRef ( false ) ; // set by AltGr @ detection
235235 const terminalPowerMode = useConfigStore ( ( state ) => state . config ?. terminalPowerMode ?? 'performance' ) ;
236+ const keyboardShortcutsEnabled = useConfigStore ( ( state ) => areKeyboardShortcutsEnabled ( state . config ) ) ;
237+ const keyboardShortcutsEnabledRef = useRef ( keyboardShortcutsEnabled ) ;
236238 const useBatterySaverTerminalVisibility = terminalPowerMode === 'batterySaver' ;
237239 const panelVisible = isActive ;
238240 const effectiveVisible = useBatterySaverTerminalVisibility ? panelVisible && windowFocused : true ;
@@ -295,6 +297,10 @@ export const TerminalPanel: React.FC<TerminalPanelProps> = React.memo(({ panel,
295297 isCliPanelRef . current = isCliPanel ;
296298 } , [ isCliPanel ] ) ;
297299
300+ useEffect ( ( ) => {
301+ keyboardShortcutsEnabledRef . current = keyboardShortcutsEnabled ;
302+ } , [ keyboardShortcutsEnabled ] ) ;
303+
298304 useEffect ( ( ) => {
299305 if ( terminalState ?. isCliReady && ! isCliReady ) {
300306 setIsCliReady ( true ) ;
@@ -767,12 +773,11 @@ export const TerminalPanel: React.FC<TerminalPanelProps> = React.memo(({ panel,
767773
768774 // Open search on Ctrl/Cmd+F from the container div
769775 const handleTerminalKeyDown = useCallback ( ( e : React . KeyboardEvent ) => {
770- const ctrlOrMeta = e . ctrlKey || e . metaKey ;
771- if ( ctrlOrMeta && e . key . toLowerCase ( ) === 'f' ) {
776+ if ( shouldOpenTerminalSearch ( e , keyboardShortcutsEnabled ) ) {
772777 e . preventDefault ( ) ;
773778 openSearch ( ) ;
774779 }
775- } , [ openSearch ] ) ;
780+ } , [ keyboardShortcutsEnabled , openSearch ] ) ;
776781
777782 const getDropdownPosition = useCallback ( ( ) : { x : number ; y : number } => {
778783 const container = terminalRef . current ;
@@ -906,6 +911,8 @@ export const TerminalPanel: React.FC<TerminalPanelProps> = React.memo(({ panel,
906911
907912 // Intercept app-level shortcuts before xterm consumes them
908913 terminal . attachCustomKeyEventHandler ( ( e : KeyboardEvent ) => {
914+ if ( ! keyboardShortcutsEnabledRef . current ) return ! isHotkeyEnabledForEvent ( e ) ;
915+
909916 const ctrlOrMeta = e . ctrlKey || e . metaKey ;
910917
911918 // Ctrl/Cmd+K: clear xterm scrollback without writing ^K to the PTY.
@@ -925,6 +932,7 @@ export const TerminalPanel: React.FC<TerminalPanelProps> = React.memo(({ panel,
925932 isTuiActive : tuiActiveRef . current ,
926933 isCliPanel : isCliPanelRef . current ,
927934 isMac : isMac ( ) ,
935+ keyboardShortcutsEnabled : keyboardShortcutsEnabledRef . current ,
928936 } ) ;
929937
930938 // Shift+Enter sends the same ESC+CR sequence as Alt+Enter for CLI
0 commit comments