fix: single ENTER submits slash command argument autocomplete (#944) (#953)

When completing a /gsd subcommand via autocomplete (e.g. selecting 'auto'
after typing '/gsd '), ENTER now submits immediately instead of requiring
a second press.

The selectConfirm handler already fell through to submit when the
autocomplete prefix started with '/' (completing the command name itself).
Now it also falls through when the cursor is in a slash command context
(completing an argument like 'auto', 'status', 'help').

Non-slash completions (@file references, paths) still require explicit
ENTER to submit — only slash command arguments auto-submit.
This commit is contained in:
Tom Boucher 2026-03-17 17:28:40 -04:00 committed by GitHub
parent 614012f38a
commit 188e7a67c4

View file

@ -559,7 +559,9 @@ export class Editor implements Component, Focusable {
this.state.cursorLine = result.cursorLine;
this.setCursorCol(result.cursorCol);
if (this.autocompletePrefix.startsWith("/")) {
if (this.autocompletePrefix.startsWith("/") || this.isInSlashCommandContext(
(this.state.lines[this.state.cursorLine] || "").slice(0, this.state.cursorCol),
)) {
this.cancelAutocomplete();
// Fall through to submit
} else {