From 346097acabef9016f23729fbaf5db7cdafc98641 Mon Sep 17 00:00:00 2001 From: Ismail Pelaseyed Date: Tue, 29 Jul 2025 18:34:54 +0200 Subject: [PATCH] minor tweaks --- package.json | 2 +- src/hooks/use-input-handler.ts | 55 ++++++++++++++++------------------ 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 9d3f565..538a865 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vibe-kit/grok-cli", - "version": "0.0.16", + "version": "0.0.17", "description": "An open-source AI agent that brings the power of Grok directly into your terminal.", "main": "dist/index.js", "bin": { diff --git a/src/hooks/use-input-handler.ts b/src/hooks/use-input-handler.ts index c0ff353..0ac094d 100644 --- a/src/hooks/use-input-handler.ts +++ b/src/hooks/use-input-handler.ts @@ -621,31 +621,33 @@ Respond with ONLY the commit message, no additional text.`; ); if (filteredSuggestions.length === 0) { - return; - } - - if (key.upArrow) { - setSelectedCommandIndex((prev) => - prev === 0 ? filteredSuggestions.length - 1 : prev - 1 - ); - return; - } - if (key.downArrow) { - setSelectedCommandIndex( - (prev) => (prev + 1) % filteredSuggestions.length - ); - return; - } - if (key.tab || key.return) { - const safeIndex = Math.min( - selectedCommandIndex, - filteredSuggestions.length - 1 - ); - const selectedCommand = filteredSuggestions[safeIndex]; - setInput(selectedCommand.command + " "); setShowCommandSuggestions(false); setSelectedCommandIndex(0); - return; + // Continue processing the input instead of returning + } else { + if (key.upArrow) { + setSelectedCommandIndex((prev) => + prev === 0 ? filteredSuggestions.length - 1 : prev - 1 + ); + return; + } + if (key.downArrow) { + setSelectedCommandIndex( + (prev) => (prev + 1) % filteredSuggestions.length + ); + return; + } + if (key.tab || key.return) { + const safeIndex = Math.min( + selectedCommandIndex, + filteredSuggestions.length - 1 + ); + const selectedCommand = filteredSuggestions[safeIndex]; + setInput(selectedCommand.command + " "); + setShowCommandSuggestions(false); + setSelectedCommandIndex(0); + return; + } } } @@ -707,12 +709,7 @@ Respond with ONLY the commit message, no additional text.`; const newInput = input + inputChar; setInput(newInput); - if ( - newInput.startsWith("/") || - ["ls", "pwd", "cd", "cat", "mkdir", "touch"].some((cmd) => - cmd.startsWith(newInput) - ) - ) { + if (newInput.startsWith("/")) { setShowCommandSuggestions(true); setSelectedCommandIndex(0); } else {