diff --git a/packages/cli/src/ui/hooks/useCommandCompletion.tsx b/packages/cli/src/ui/hooks/useCommandCompletion.tsx index 097a1e63b3..45f001dbcd 100644 --- a/packages/cli/src/ui/hooks/useCommandCompletion.tsx +++ b/packages/cli/src/ui/hooks/useCommandCompletion.tsx @@ -115,6 +115,19 @@ export function useCommandCompletion({ const codePoints = toCodePoints(currentLine); if (shellModeActive) { + if (currentLine.trim().length === 0) { + return { + completionMode: CompletionMode.IDLE, + query: null, + completionStart: -1, + completionEnd: -1, + shellTokenIsCommand: false, + shellTokens: [], + shellCursorIndex: -1, + shellCommandToken: '', + }; + } + const tokenInfo = getTokenAtCursor(currentLine, cursorCol); if (tokenInfo) { return {