MCPcopy Create free account
hub / github.com/anus-dev/ANUS / InputPrompt

Function InputPrompt

packages/cli/src/ui/components/InputPrompt.tsx:49–636  ·  view source on GitHub ↗
({
  buffer,
  onSubmit,
  userMessages,
  onClearScreen,
  config,
  slashCommands,
  commandContext,
  placeholder = '  Type your message or @path/to/file',
  focus = true,
  inputWidth,
  suggestionsWidth,
  shellModeActive,
  setShellModeActive,
  onEscapePromptChange,
  vimHandleInput,
})

Source from the content-addressed store, hash-verified

47}
48
49export const InputPrompt: React.FC<InputPromptProps> = ({
50 buffer,
51 onSubmit,
52 userMessages,
53 onClearScreen,
54 config,
55 slashCommands,
56 commandContext,
57 placeholder = ' Type your message or @path/to/file',
58 focus = true,
59 inputWidth,
60 suggestionsWidth,
61 shellModeActive,
62 setShellModeActive,
63 onEscapePromptChange,
64 vimHandleInput,
65}) => {
66 const [justNavigatedHistory, setJustNavigatedHistory] = useState(false);
67 const [escPressCount, setEscPressCount] = useState(0);
68 const [showEscapePrompt, setShowEscapePrompt] = useState(false);
69 const escapeTimerRef = useRef<NodeJS.Timeout | null>(null);
70
71 const [dirs, setDirs] = useState<readonly string[]>(
72 config.getWorkspaceContext().getDirectories(),
73 );
74 const dirsChanged = config.getWorkspaceContext().getDirectories();
75 useEffect(() => {
76 if (dirs.length !== dirsChanged.length) {
77 setDirs(dirsChanged);
78 }
79 }, [dirs.length, dirsChanged]);
80 const [reverseSearchActive, setReverseSearchActive] = useState(false);
81 const [textBeforeReverseSearch, setTextBeforeReverseSearch] = useState('');
82 const [cursorPosition, setCursorPosition] = useState<[number, number]>([
83 0, 0,
84 ]);
85 const shellHistory = useShellHistory(config.getProjectRoot());
86 const historyData = shellHistory.history;
87
88 const completion = useCommandCompletion(
89 buffer,
90 dirs,
91 config.getTargetDir(),
92 slashCommands,
93 commandContext,
94 reverseSearchActive,
95 config,
96 );
97
98 const reverseSearchCompletion = useReverseSearchCompletion(
99 buffer,
100 historyData,
101 reverseSearchActive,
102 );
103 const resetCompletionState = completion.resetCompletionState;
104 const resetReverseSearchCompletionState =
105 reverseSearchCompletion.resetCompletionState;
106

Callers

nothing calls this directly

Calls 15

useShellHistoryFunction · 0.85
useCommandCompletionFunction · 0.85
useInputHistoryFunction · 0.85
clipboardHasImageFunction · 0.85
saveClipboardImageFunction · 0.85
logicalPosToOffsetFunction · 0.85
cpSliceFunction · 0.85
cpLenFunction · 0.85
useKeypressFunction · 0.85
getDirectoriesMethod · 0.80

Tested by

no test coverage detected