From aeecf5a9e705c42d42b454eb4ea986eebb378023 Mon Sep 17 00:00:00 2001 From: jacob314 Date: Wed, 25 Feb 2026 08:23:53 -0800 Subject: [PATCH] fix(cli): prevent auto-submit on Enter when navigating to first shell autocomplete suggestion When using shell autocomplete, pressing Down then Up returns the activeSuggestionIndex to 0. If the first suggestion happened to be an exact match, the InputPrompt would bypass the normal autocomplete logic and eagerly submit the prompt on Enter because it ignored whether the user had actively navigated. This fix updates the isPerfectMatch check to require that the user has not navigated the suggestions list, ensuring that explicitly selected items always autocomplete instead of submitting. --- packages/cli/src/ui/components/InputPrompt.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/ui/components/InputPrompt.tsx b/packages/cli/src/ui/components/InputPrompt.tsx index 7d7c9b5709..30a6191961 100644 --- a/packages/cli/src/ui/components/InputPrompt.tsx +++ b/packages/cli/src/ui/components/InputPrompt.tsx @@ -900,7 +900,9 @@ export const InputPrompt: React.FC = ({ completion.isPerfectMatch && keyMatchers[Command.SUBMIT](key) && recentUnsafePasteTime === null && - (!completion.showSuggestions || completion.activeSuggestionIndex <= 0) + (!completion.showSuggestions || + (completion.activeSuggestionIndex <= 0 && + !hasUserNavigatedSuggestions.current)) ) { handleSubmit(buffer.text); return true;