File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ Interaction with other input helpers
2727 - "/" slash command UI is disabled.
2828- When in slash command mode (input starts with /):
2929 - "@" file search suggestions are disabled.
30+ - Enter submits the highlighted slash command directly (except /title, which requires Tab to select first).
31+ - Tab selects the highlighted command without submitting.
3032
3133Submission behavior
3234
Original file line number Diff line number Diff line change @@ -463,7 +463,28 @@ const UserInput: React.FC<UserInputProps> = ({
463463
464464 if ( ( key . return && ! key . shift ) || key . tab ) {
465465 if ( filteredCommands . length > 0 ) {
466- selectSlashCommand ( filteredCommands [ selectedCommandIndex ] . name ) ;
466+ const commandName = filteredCommands [ selectedCommandIndex ] . name ;
467+ if ( key . return && commandName !== "title" ) {
468+ // select and submit the command
469+ const commandText = "/" + commandName ;
470+ inputHistory . addEntry ( commandText ) ;
471+
472+ // queue up when responding/generating
473+ if ( ! isRemoteMode && ( isWaitingForResponse || isCompacting ) ) {
474+ void messageQueue . enqueueMessage ( commandText ) ;
475+ } else {
476+ onSubmit ( commandText ) ;
477+ }
478+
479+ // reset after submitting command
480+ textBuffer . clear ( ) ;
481+ setInputText ( "" ) ;
482+ setCursorPosition ( 0 ) ;
483+ setShowSlashCommands ( false ) ;
484+ setShowBashMode ( false ) ;
485+ } else {
486+ selectSlashCommand ( commandName ) ;
487+ }
467488 }
468489 return true ;
469490 }
You can’t perform that action at this time.
0 commit comments