feat(terminal): add keyboard shortcut to toggle expand/collapse (#1180)
Add Cmd/Ctrl+Shift+E shortcut to toggle terminal expand/collapse state. The shortcut hint is displayed in the expand button tooltip. Co-authored-by: Test User <test@example.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -197,12 +197,19 @@ export function Terminal({
|
||||
e.stopPropagation();
|
||||
onClose();
|
||||
}
|
||||
|
||||
// Cmd/Ctrl+Shift+E to toggle expand/collapse
|
||||
if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key.toLowerCase() === 'e') {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
onToggleExpand?.();
|
||||
}
|
||||
};
|
||||
|
||||
// Use capture phase to get the event before xterm
|
||||
window.addEventListener('keydown', handleKeyDown, true);
|
||||
return () => window.removeEventListener('keydown', handleKeyDown, true);
|
||||
}, [isActive, onClose]);
|
||||
}, [isActive, onClose, onToggleExpand]);
|
||||
|
||||
// Cleanup on unmount
|
||||
useEffect(() => {
|
||||
|
||||
@@ -188,7 +188,7 @@ export function TerminalHeader({
|
||||
e.stopPropagation();
|
||||
onToggleExpand();
|
||||
}}
|
||||
title={isExpanded ? t('terminal:expand.collapse') : t('terminal:expand.expand')}
|
||||
title={`${isExpanded ? t('terminal:expand.collapse') : t('terminal:expand.expand')} (${navigator.platform.includes('Mac') ? '⌘' : 'Ctrl'}+Shift+E)`}
|
||||
>
|
||||
{isExpanded ? (
|
||||
<Minimize2 className="h-3.5 w-3.5" />
|
||||
|
||||
Reference in New Issue
Block a user