diff --git a/packages/tui/CHANGELOG.md b/packages/tui/CHANGELOG.md index b6a4a90e..a08dceab 100644 --- a/packages/tui/CHANGELOG.md +++ b/packages/tui/CHANGELOG.md @@ -9,6 +9,7 @@ ### Fixed - Fixed blockquote text color breaking after inline links (and other inline elements) due to missing style restoration prefix +- Fixed slash-command Tab completion from immediately chaining into argument autocomplete after completing the command name, restoring flows like `/model` that submit into a selector dialog ([#2577](https://github.com/badlogic/pi-mono/issues/2577)) ## [0.62.0] - 2026-03-23 diff --git a/packages/tui/src/components/editor.ts b/packages/tui/src/components/editor.ts index c12219d3..e3fd327b 100644 --- a/packages/tui/src/components/editor.ts +++ b/packages/tui/src/components/editor.ts @@ -591,8 +591,6 @@ export class Editor implements Component, Focusable { if (kb.matches(data, "tui.input.tab")) { const selected = this.autocompleteList.getSelectedItem(); if (selected && this.autocompleteProvider) { - const shouldChainSlashArgumentAutocomplete = this.shouldChainSlashArgumentAutocompleteOnTabSelection(); - this.pushUndoSnapshot(); this.lastAction = null; const result = this.autocompleteProvider.applyCompletion( @@ -607,10 +605,6 @@ export class Editor implements Component, Focusable { this.setCursorCol(result.cursorCol); this.cancelAutocomplete(); if (this.onChange) this.onChange(this.getText()); - - if (shouldChainSlashArgumentAutocomplete && this.isBareCompletedSlashCommandAtCursor()) { - this.tryTriggerAutocomplete(); - } } return; } @@ -1986,26 +1980,6 @@ export class Editor implements Component, Focusable { return this.isSlashMenuAllowed() && textBeforeCursor.trimStart().startsWith("/"); } - private shouldChainSlashArgumentAutocompleteOnTabSelection(): boolean { - if (this.autocompleteState !== "regular") { - return false; - } - - const currentLine = this.state.lines[this.state.cursorLine] || ""; - const textBeforeCursor = currentLine.slice(0, this.state.cursorCol); - return this.isInSlashCommandContext(textBeforeCursor) && !textBeforeCursor.trimStart().includes(" "); - } - - private isBareCompletedSlashCommandAtCursor(): boolean { - const currentLine = this.state.lines[this.state.cursorLine] || ""; - if (this.state.cursorCol !== currentLine.length) { - return false; - } - - const textBeforeCursor = currentLine.slice(0, this.state.cursorCol).trimStart(); - return /^\/\S+ $/.test(textBeforeCursor); - } - // Autocomplete methods /** * Find the best autocomplete item index for the given prefix.