diff --git a/extensions/cli/spec/shell-mode.md b/extensions/cli/spec/shell-mode.md index 2a4693b8a3..dd5c2dc182 100644 --- a/extensions/cli/spec/shell-mode.md +++ b/extensions/cli/spec/shell-mode.md @@ -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 diff --git a/extensions/cli/src/ui/UserInput.tsx b/extensions/cli/src/ui/UserInput.tsx index fb31e4e5c1..4706881203 100644 --- a/extensions/cli/src/ui/UserInput.tsx +++ b/extensions/cli/src/ui/UserInput.tsx @@ -463,7 +463,28 @@ const UserInput: React.FC = ({ 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; }