Skip to content

fix(tui): allow slash command menu on first line with existing text#1227

Merged
badlogic merged 1 commit intobadlogic:mainfrom
aliou:feat/allow-slash-menu-on-first-line
Feb 4, 2026
Merged

fix(tui): allow slash command menu on first line with existing text#1227
badlogic merged 1 commit intobadlogic:mainfrom
aliou:feat/allow-slash-menu-on-first-line

Conversation

@aliou
Copy link
Copy Markdown
Contributor

@aliou aliou commented Feb 3, 2026

Hello!

Noticed that when trying to prepend a custom command when the editor has multiple line, the slash command completion wouldn't trigger.


Summary by Opus:

Changes isSlashMenuAllowed() in packages/tui/src/components/editor.ts from checking that all non-cursor lines are empty to simply checking cursorLine === 0.

Before: Typing / at the beginning of line 0 would not trigger the slash command autocomplete menu if any other line had content. This prevented the workflow of writing text first, then prepending a slash command to use that text as the command's argument.

After: The slash command menu triggers on line 0 regardless of content on other lines. It still does not trigger on non-first lines, preserving the fix for #904 (slash menu appearing on arbitrary new lines in multi-line input).

File: packages/tui/src/components/editor.ts

  • isSlashMenuAllowed(): changed from a loop checking all lines to return this.state.cursorLine === 0
  • isAtStartOfMessage() and isInSlashCommandContext() are unchanged but inherit the new behavior

Commands that already accept arguments via startsWith (/model, /compact, /name, /export) work with trailing text. Commands that use exact match (/settings, /new, etc.) are unaffected since they don't accept arguments.

@badlogic
Copy link
Copy Markdown
Owner

badlogic commented Feb 3, 2026

That's on purpose. What's the use case for this?

@aliou
Copy link
Copy Markdown
Contributor Author

aliou commented Feb 3, 2026

I use a few commands (like handoff or skill) but sometimes forget to start my message. So I go back to the start of the editor to add it, but the completion doesn't trigger I often don't remember from the top of my head the exact name of the command/skill I need to use, just enough for the tab to work.

Right now i end up copying the text, clearing the editor, typing+tab the command and then re-pasting the rest of the message.

@aliou aliou force-pushed the feat/allow-slash-menu-on-first-line branch from cdd00d4 to 544bf06 Compare February 3, 2026 23:10
@badlogic badlogic force-pushed the feat/allow-slash-menu-on-first-line branch from 544bf06 to 9920d89 Compare February 4, 2026 13:03
@badlogic badlogic merged commit 52638e1 into badlogic:main Feb 4, 2026
1 check passed
@badlogic
Copy link
Copy Markdown
Owner

badlogic commented Feb 4, 2026

Looking good, merged!

@aliou aliou deleted the feat/allow-slash-menu-on-first-line branch February 4, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants