[PR #6031] fix(tui): reopen autocomplete after backspace deletes space #11704

Closed
opened 2026-02-16 18:16:38 -05:00 by yindo · 0 comments
Owner

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

State: closed
Merged: Yes


Problem

When typing / or @, autocomplete shows suggestions.
If you press space by mistake, the dropdown closes.
When you press backspace to remove the space, autocomplete does not come back, even though the text is valid again.

Steps to Reproduce

  1. Type /something → autocomplete appears
  2. Press space → autocomplete closes
  3. Press backspace → autocomplete does not reopen

Fix

Updated the onInput logic to reopen autocomplete when the cursor is back in a valid position.

  • For /
    Autocomplete reopens when the text starts with / and there is no space before the cursor

  • For @
    Finds the closest @ before the cursor and reopens autocomplete if there is no space between @ and the cursor

Testing

  • /something → space → backspace → autocomplete reopens
  • @agent → space → backspace → autocomplete reopens
  • Normal behavior is unchanged
  • Text like test/path does not trigger / autocomplete

https://github.com/user-attachments/assets/37d91fa1-2af7-466a-8981-fd5d31ec21c9

https://github.com/user-attachments/assets/a37e46dd-e74b-4bec-94e0-fb390625847a

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6031 **State:** closed **Merged:** Yes --- ## Problem When typing `/` or `@`, autocomplete shows suggestions. If you press **space** by mistake, the dropdown closes. When you press **backspace** to remove the space, autocomplete does not come back, even though the text is valid again. ## Steps to Reproduce 1. Type `/something` → autocomplete appears 2. Press space → autocomplete closes 3. Press backspace → autocomplete does not reopen ## Fix Updated the `onInput` logic to reopen autocomplete when the cursor is back in a valid position. - **For `/`** Autocomplete reopens when the text starts with `/` and there is no space before the cursor - **For `@`** Finds the closest `@` before the cursor and reopens autocomplete if there is no space between `@` and the cursor ## Testing - `/something` → space → backspace → autocomplete reopens - `@agent` → space → backspace → autocomplete reopens - Normal behavior is unchanged - Text like `test/path` does not trigger `/` autocomplete https://github.com/user-attachments/assets/37d91fa1-2af7-466a-8981-fd5d31ec21c9 https://github.com/user-attachments/assets/a37e46dd-e74b-4bec-94e0-fb390625847a
yindo added the pull-request label 2026-02-16 18:16:38 -05:00
yindo closed this issue 2026-02-16 18:16:38 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11704