Fix bug updating the cursor after navigating history. (#507)

This commit is contained in:
Jacob Richman
2025-05-23 09:40:01 -07:00
committed by GitHub
parent a008d81780
commit a96ff934ea
3 changed files with 269 additions and 16 deletions

View File

@@ -81,20 +81,12 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
[onSubmit, buffer, resetCompletionState],
);
const onChangeAndMoveCursor = useCallback(
(newValue: string) => {
buffer.setText(newValue);
buffer.move('end');
},
[buffer],
);
const inputHistory = useInputHistory({
userMessages,
onSubmit: handleSubmitAndClear,
isActive: !completion.showSuggestions,
currentQuery: buffer.text,
onChangeAndMoveCursor,
onChange: buffer.setText,
});
const completionSuggestions = completion.suggestions;