[PR #11970] fix(tui): allow Enter to submit when no autocomplete matches #14007

Open
opened 2026-02-16 18:18:49 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11970

State: open
Merged: No


Fixed a bug where typing paths starting with / (like /home/user/file.txt read this file) in the TUI input would show "No matching items" and block the Enter key from submitting. fix #11965

Root cause: The return key handler in autocomplete.tsx unconditionally called select() and e.preventDefault(), even when there were no matching options. This prevented form submission.

Fix: Only intercept Enter when options().length > 0. When no commands match (user is typing a path), close the autocomplete panel and let the normal submit handler process the input without preventing default behavior.

Tested by inputting /Users/hiro/opencode/README.md tell me what the file says in TUI:

  • Can type the full path
  • Shows "No matching items" when no commands match
  • Pressing Enter submits the input successfully
  • Command autocomplete still works for actual commands like /models
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11970 **State:** open **Merged:** No --- Fixed a bug where typing paths starting with `/` (like `/home/user/file.txt read this file`) in the TUI input would show "No matching items" and block the Enter key from submitting. fix #11965 **Root cause:** The `return` key handler in `autocomplete.tsx` unconditionally called `select()` and `e.preventDefault()`, even when there were no matching options. This prevented form submission. **Fix:** Only intercept Enter when `options().length > 0`. When no commands match (user is typing a path), close the autocomplete panel and let the normal submit handler process the input without preventing default behavior. Tested by inputting `/Users/hiro/opencode/README.md tell me what the file says` in TUI: - Can type the full path - Shows "No matching items" when no commands match - Pressing Enter submits the input successfully - Command autocomplete still works for actual commands like `/models`
yindo added the pull-request label 2026-02-16 18:18:49 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14007