From 75ecb4a81fa76aa00374601b2c0bbe9d657b4aa7 Mon Sep 17 00:00:00 2001
From: Evan Senter <evansenter@gmail.com>
Date: Sat, 19 Apr 2025 14:31:59 +0100
Subject: Adding in a history buffer (#38)

Up and down arrows traverse the command history.
---
 packages/cli/src/ui/components/InputPrompt.tsx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'packages/cli/src/ui/components/InputPrompt.tsx')

diff --git a/packages/cli/src/ui/components/InputPrompt.tsx b/packages/cli/src/ui/components/InputPrompt.tsx
index 3b6b10b1..b5d0b2b5 100644
--- a/packages/cli/src/ui/components/InputPrompt.tsx
+++ b/packages/cli/src/ui/components/InputPrompt.tsx
@@ -14,12 +14,15 @@ interface InputPromptProps {
   setQuery: (value: string) => void;
   onSubmit: (value: string) => void;
   isActive: boolean;
+  forceKey?: number;
 }
 
 export const InputPrompt: React.FC<InputPromptProps> = ({
   query,
   setQuery,
   onSubmit,
+  isActive,
+  forceKey,
 }) => {
   const model = globalConfig.getModel();
 
@@ -28,11 +31,12 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
       <Text color={'white'}>&gt; </Text>
       <Box flexGrow={1}>
         <TextInput
+          key={forceKey?.toString()}
           value={query}
           onChange={setQuery}
           onSubmit={onSubmit}
           showCursor={true}
-          focus={true}
+          focus={isActive}
           placeholder={`Ask Gemini (${model})... (try "/init" or "/help")`}
         />
       </Box>
-- 
cgit v1.2.3

