From 35e02b6cb0f13152be732181fbe6780ee3736988 Mon Sep 17 00:00:00 2001 From: JayadityaGit Date: Tue, 17 Mar 2026 18:09:25 +0530 Subject: [PATCH] fix(cli): prevent settings escape key from cancelling active turn --- .../components/shared/BaseSettingsDialog.tsx | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/cli/src/ui/components/shared/BaseSettingsDialog.tsx b/packages/cli/src/ui/components/shared/BaseSettingsDialog.tsx index d96646e8a5a..9369ec3b4b1 100644 --- a/packages/cli/src/ui/components/shared/BaseSettingsDialog.tsx +++ b/packages/cli/src/ui/components/shared/BaseSettingsDialog.tsx @@ -275,7 +275,7 @@ export function BaseSettingsDialog({ (key: Key) => { // Let parent handle custom keys first (only if not editing) if (!editingKey && onKeyPress?.(key, currentItem)) { - return; + return true; } // Edit mode handling @@ -286,43 +286,43 @@ export function BaseSettingsDialog({ // Navigation within edit buffer if (keyMatchers[Command.MOVE_LEFT](key)) { editDispatch({ type: 'MOVE_LEFT' }); - return; + return true; } if (keyMatchers[Command.MOVE_RIGHT](key)) { editDispatch({ type: 'MOVE_RIGHT' }); - return; + return true; } if (keyMatchers[Command.HOME](key)) { editDispatch({ type: 'HOME' }); - return; + return true; } if (keyMatchers[Command.END](key)) { editDispatch({ type: 'END' }); - return; + return true; } // Backspace if (keyMatchers[Command.DELETE_CHAR_LEFT](key)) { editDispatch({ type: 'DELETE_LEFT' }); - return; + return true; } // Delete if (keyMatchers[Command.DELETE_CHAR_RIGHT](key)) { editDispatch({ type: 'DELETE_RIGHT' }); - return; + return true; } // Escape in edit mode - commit (consistent with SettingsDialog) if (keyMatchers[Command.ESCAPE](key)) { commitEdit(); - return; + return true; } // Enter in edit mode - commit if (keyMatchers[Command.RETURN](key)) { commitEdit(); - return; + return true; } // Up/Down in edit mode - commit and navigate. @@ -331,7 +331,7 @@ export function BaseSettingsDialog({ if (keyMatchers[Command.DIALOG_NAVIGATION_UP](key) && !key.insertable) { commitEdit(); moveUp(); - return; + return true; } if ( keyMatchers[Command.DIALOG_NAVIGATION_DOWN](key) && @@ -339,7 +339,7 @@ export function BaseSettingsDialog({ ) { commitEdit(); moveDown(); - return; + return true; } // Character input @@ -350,7 +350,7 @@ export function BaseSettingsDialog({ isNumberType: type === 'number', }); } - return; + return true; } // Not in edit mode - handle navigation and actions @@ -396,16 +396,16 @@ export function BaseSettingsDialog({ // Tab - switch focus section if (key.name === 'tab' && finalShowScopeSelector) { setFocusSection((s) => (s === 'settings' ? 'scope' : 'settings')); - return; + return true; } // Escape - close dialog if (keyMatchers[Command.ESCAPE](key)) { onClose(); - return; + return true; } - return; + return false; }, { isActive: true,