MCPcopy
hub / github.com/claude-code-best/claude-code / PromptInput

Function PromptInput

src/components/PromptInput/PromptInput.tsx:225–2601  ·  view source on GitHub ↗
({
  debug,
  ideSelection,
  toolPermissionContext,
  setToolPermissionContext,
  apiKeyStatus,
  commands,
  agents,
  isLoading,
  verbose,
  messages,
  onAutoUpdaterResult,
  autoUpdaterResult,
  input,
  onInputChange,
  mode,
  onModeChange,
  stashedPrompt,
  setStashedPrompt,
  submitCount,
  onShowMessageSelector,
  onMessageActionsEnter,
  mcpClients,
  pastedContents,
  setPastedContents,
  vimMode,
  setVimMode,
  showBashesDialog,
  setShowBashesDialog,
  onExit,
  getToolUseContext,
  onSubmit: onSubmitProp,
  onAgentSubmit,
  isSearchingHistory,
  setIsSearchingHistory,
  onDismissSideQuestion,
  isSideQuestionVisible,
  helpOpen,
  setHelpOpen,
  hasSuppressedDialogs,
  isLocalJSXCommandActive = false,
  insertTextRef,
  voiceInterimRange,
}: Props)

Source from the content-addressed store, hash-verified

223const MIN_INPUT_VIEWPORT_LINES = 3;
224
225function PromptInput({
226 debug,
227 ideSelection,
228 toolPermissionContext,
229 setToolPermissionContext,
230 apiKeyStatus,
231 commands,
232 agents,
233 isLoading,
234 verbose,
235 messages,
236 onAutoUpdaterResult,
237 autoUpdaterResult,
238 input,
239 onInputChange,
240 mode,
241 onModeChange,
242 stashedPrompt,
243 setStashedPrompt,
244 submitCount,
245 onShowMessageSelector,
246 onMessageActionsEnter,
247 mcpClients,
248 pastedContents,
249 setPastedContents,
250 vimMode,
251 setVimMode,
252 showBashesDialog,
253 setShowBashesDialog,
254 onExit,
255 getToolUseContext,
256 onSubmit: onSubmitProp,
257 onAgentSubmit,
258 isSearchingHistory,
259 setIsSearchingHistory,
260 onDismissSideQuestion,
261 isSideQuestionVisible,
262 helpOpen,
263 setHelpOpen,
264 hasSuppressedDialogs,
265 isLocalJSXCommandActive = false,
266 insertTextRef,
267 voiceInterimRange,
268}: Props): React.ReactNode {
269 const mainLoopModel = useMainLoopModel();
270 // A local-jsx command (e.g., /mcp while agent is running) renders a full-
271 // screen dialog on top of PromptInput via the immediate-command path with
272 // shouldHidePromptInput: false. Those dialogs don't register in the overlay
273 // system, so treat them as a modal overlay here to stop navigation keys from
274 // leaking into TextInput/footer handlers and stacking a second dialog.
275 const isModalOverlayActive = useIsModalOverlayActive() || isLocalJSXCommandActive;
276 const [isAutoUpdating, setIsAutoUpdating] = useState(false);
277 const [exitMessage, setExitMessage] = useState<{
278 show: boolean;
279 key?: string;
280 }>({ show: false });
281 const [cursorOffset, setCursorOffset] = useState<number>(input.length);
282 // Track the last input value set via internal handlers so we can detect

Callers

nothing calls this directly

Calls 15

useInputFunction · 0.90
useMainLoopModelFunction · 0.85
useIsModalOverlayActiveFunction · 0.85
useAppStateStoreFunction · 0.85
useSetAppStateFunction · 0.85
useAppStateFunction · 0.85
useCommandQueueFunction · 0.85
getGlobalConfigFunction · 0.85
isFastModeEnabledFunction · 0.85
getViewedTeammateTaskFunction · 0.85
useHistorySearchFunction · 0.85

Tested by

no test coverage detected