From e665d4f1987aecc1be4db315c7544a6da5ed3d5b Mon Sep 17 00:00:00 2001
From: Jacob Richman <jacob314@gmail.com>
Date: Tue, 13 May 2025 16:23:14 -0700
Subject: First step refactoring InputPrompt (#335)

---
 packages/cli/src/ui/App.tsx | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

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

diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx
index 7b81ada1..a2ed7cdc 100644
--- a/packages/cli/src/ui/App.tsx
+++ b/packages/cli/src/ui/App.tsx
@@ -9,7 +9,6 @@ import { Box, Static, Text, useStdout } from 'ink';
 import { StreamingState, type HistoryItem } from './types.js';
 import { useGeminiStream } from './hooks/useGeminiStream.js';
 import { useLoadingIndicator } from './hooks/useLoadingIndicator.js';
-import { useInputHistory } from './hooks/useInputHistory.js';
 import { useThemeCommand } from './hooks/useThemeCommand.js';
 import { Header } from './components/Header.js';
 import { LoadingIndicator } from './components/LoadingIndicator.js';
@@ -121,18 +120,6 @@ export const App = ({ config, settings, cliVersion }: AppProps) => {
     slashCommands,
   );
 
-  const inputHistory = useInputHistory({
-    userMessages,
-    onSubmit: (value) => {
-      // Adapt onSubmit to use the lifted setQuery
-      handleFinalSubmit(value);
-      onChangeAndMoveCursor('');
-    },
-    isActive: isInputActive && !completion.showSuggestions,
-    currentQuery: query,
-    onChangeAndMoveCursor,
-  });
-
   // --- Render Logic ---
 
   // Get terminal width
@@ -236,12 +223,11 @@ export const App = ({ config, settings, cliVersion }: AppProps) => {
                 onChange={setQuery}
                 onChangeAndMoveCursor={onChangeAndMoveCursor}
                 editorState={editorState}
-                onSubmit={inputHistory.handleSubmit}
+                onSubmit={handleFinalSubmit} // Pass handleFinalSubmit directly
                 showSuggestions={completion.showSuggestions}
                 suggestions={completion.suggestions}
                 activeSuggestionIndex={completion.activeSuggestionIndex}
-                navigateHistoryUp={inputHistory.navigateUp}
-                navigateHistoryDown={inputHistory.navigateDown}
+                userMessages={userMessages} // Pass userMessages
                 navigateSuggestionUp={completion.navigateUp}
                 navigateSuggestionDown={completion.navigateDown}
                 resetCompletion={completion.resetCompletionState}
-- 
cgit v1.2.3

