Use `Enter` on slash commands to execute (#334)

This commit is contained in:
Miguel Solorio 2025-05-13 16:08:12 -07:00 committed by GitHub
parent 4a0f5476c0
commit c4fb1ad04b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -60,6 +60,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
const base = query.substring(0, slashIndex + 1); const base = query.substring(0, slashIndex + 1);
const newValue = base + selectedSuggestion.value; const newValue = base + selectedSuggestion.value;
onChangeAndMoveCursor(newValue); onChangeAndMoveCursor(newValue);
onSubmit(newValue); // Execute the command
} else { } else {
// Handle @ command completion // Handle @ command completion
const atIndex = query.lastIndexOf('@'); const atIndex = query.lastIndexOf('@');
@ -85,7 +86,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
resetCompletion(); // Hide suggestions after selection resetCompletion(); // Hide suggestions after selection
}, },
[query, suggestions, resetCompletion, onChangeAndMoveCursor], [query, suggestions, resetCompletion, onChangeAndMoveCursor, onSubmit],
); );
const inputPreprocessor = useCallback( const inputPreprocessor = useCallback(