Merge pull request #8928 from uinstinct/cli-single-submit
feat: submit slash command in one enter
This commit is contained in:
commit
ad057ec20e
2 changed files with 24 additions and 1 deletions
|
|
@ -27,6 +27,8 @@ Interaction with other input helpers
|
|||
- "/" slash command UI is disabled.
|
||||
- When in slash command mode (input starts with /):
|
||||
- "@" file search suggestions are disabled.
|
||||
- Enter submits the highlighted slash command directly (except /title, which requires Tab to select first).
|
||||
- Tab selects the highlighted command without submitting.
|
||||
|
||||
Submission behavior
|
||||
|
||||
|
|
|
|||
|
|
@ -463,7 +463,28 @@ const UserInput: React.FC<UserInputProps> = ({
|
|||
|
||||
if ((key.return && !key.shift) || key.tab) {
|
||||
if (filteredCommands.length > 0) {
|
||||
selectSlashCommand(filteredCommands[selectedCommandIndex].name);
|
||||
const commandName = filteredCommands[selectedCommandIndex].name;
|
||||
if (key.return && commandName !== "title") {
|
||||
// select and submit the command
|
||||
const commandText = "/" + commandName;
|
||||
inputHistory.addEntry(commandText);
|
||||
|
||||
// queue up when responding/generating
|
||||
if (!isRemoteMode && (isWaitingForResponse || isCompacting)) {
|
||||
void messageQueue.enqueueMessage(commandText);
|
||||
} else {
|
||||
onSubmit(commandText);
|
||||
}
|
||||
|
||||
// reset after submitting command
|
||||
textBuffer.clear();
|
||||
setInputText("");
|
||||
setCursorPosition(0);
|
||||
setShowSlashCommands(false);
|
||||
setShowBashMode(false);
|
||||
} else {
|
||||
selectSlashCommand(commandName);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue