Skip to content

tui: whitespace-preceded "/" opens autocomplete and blocks prompt submission #50604

Closed

Description

@CyberTodBG

Description

In the TUI, any / that is preceded by whitespace opens the slash-command autocomplete and swallows Enter, so the prompt can never be submitted. It does not require the text to be a command — a normal sentence containing a spaced / is affected.

Because command options are only listed when the / is at offset 0, the popup just shows "No matching commands" mid-message, and Enter does nothing. It also happens when the spaced token is an actual command name.

Messages that cannot be sent, for example:

  • Do not use 'find /'
  • run /devices

A / should only be treated as a command when it is the first character of the prompt. The submit path already requires this (parseSlashHead returns early unless text.startsWith("/")), and the docs describe commands as starting with / ("Type / to list slash commands"), so the whitespace-preceded trigger is neither documented nor consistent with submission.

Steps to reproduce

  1. Open the TUI (opencode) in any project.
  2. Type a message containing a space followed by /, e.g. Do not use 'find /'.
  3. The autocomplete popup opens with "No matching commands".
  4. Press Enter. The message is not submitted; nothing happens.

Expected: the message submits normally. Actual: the popup opens and Enter is consumed by the autocomplete, so the prompt cannot be sent.

Notes

Likely source, on v2.0.13:

  • packages/tui/src/prompt/display.ts — slashTriggerIndex accepts a / whose preceding character is whitespace, anywhere in the prompt.
  • packages/tui/src/component/prompt/autocomplete.tsx — the autocomplete layer is enabled whenever that popup is visible and binds Enter to prompt.autocomplete.select; command options are gated on store.index === 0, so mid-message the list is empty and select() returns without submitting.

The dev branch looks already changed here (the trigger now requires value.startsWith("/") with no whitespace before the cursor), but v2.0.13 is the latest release and still has this behavior.

OpenCode version

2.0.13

Plugins

-opencode-pty, cc-safety-net@latest; local plugins devices, opencode-stats, ssh-remote

Operating System

Linux (Ubuntu on WSL2, x64) — kernel 5.15.153.1-microsoft-standard-WSL2

Terminal

WSL2 terminal, TERM=xterm-256color

Activity

  1. lucabattistini commented on Sep 22, 2026

    @lucabattistini

    Taking this. The trigger is slashTriggerIndex in packages/tui/src/prompt/display.ts: it accepts any / that follows whitespace, but a command can only open the prompt (parseSlashHead returns early otherwise, and the autocomplete only lists options at offset 0). So the popup is always empty there, and its keymap layer consumes Enter. I'm making the trigger prompt-initial and updating the test that asserted the old behavior. PR to follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions