mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Use Enter on slash commands to execute (#334)
This commit is contained in:
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user