fix(ui): prevent escape key from cancelling requests in shell mode (#21245)

This commit is contained in:
Prasanna Pal
2026-03-26 01:55:13 +05:30
committed by GitHub
parent a6a3689298
commit fd0893c346
3 changed files with 113 additions and 8 deletions

View File

@@ -686,13 +686,9 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
return true;
}
if (
key.name === 'escape' &&
(streamingState === StreamingState.Responding ||
streamingState === StreamingState.WaitingForConfirmation)
) {
return false;
}
const isGenerating =
streamingState === StreamingState.Responding ||
streamingState === StreamingState.WaitingForConfirmation;
const isPlainTab =
key.name === 'tab' && !key.shift && !key.alt && !key.ctrl && !key.cmd;
@@ -877,6 +873,12 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
return true;
}
// If we're generating and no local overlay consumed Escape, let it
// propagate to the global cancellation handler.
if (isGenerating) {
return false;
}
handleEscPress();
return true;
}