From 188e7a67c44c3eb38fa8ff5aae4d099af63fc0b3 Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Tue, 17 Mar 2026 17:28:40 -0400 Subject: [PATCH] fix: single ENTER submits slash command argument autocomplete (#944) (#953) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- packages/pi-tui/src/components/editor.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/pi-tui/src/components/editor.ts b/packages/pi-tui/src/components/editor.ts index 35508bc55..df3c4bb64 100644 --- a/packages/pi-tui/src/components/editor.ts +++ b/packages/pi-tui/src/components/editor.ts @@ -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 {