[PR #12556] fix(tui): reset DialogSelect filter on Cmd+Delete #14265

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

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

State: open
Merged: No


Fixes #12559

What does this PR do?

On macOS, pressing Cmd+Delete in any DialogSelect input clears the text visually but doesn't reset the filter. The list stays filtered on the old query even though the input is empty.

The root cause is that Cmd+Delete is a macOS line-kill that the terminal/input widget handles internally — it updates the input's content without firing the onInput event that DialogSelect relies on to sync filter state.

The fix adds an onContentChange handler alongside onInput. onContentChange fires whenever the input widget's underlying edit buffer changes, regardless of how it changed, so it catches Cmd+Delete. It reads the actual input.value and updates the filter. A dedup guard (if (value === store.filter) return) prevents redundant updates during normal typing where both events fire.

This pattern is already used in the prompt input component (packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx).

How did you verify your code works?

Ran bun dev from source, tested with 2 different DialogSelect inputs (model picker and connect a new provider): typed a query to filter the list, then pressed Cmd+Delete. The input cleared and the list immediately returned to the unfiltered state.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12556 **State:** open **Merged:** No --- Fixes #12559 ### What does this PR do? On macOS, pressing Cmd+Delete in any `DialogSelect` input clears the text visually but doesn't reset the filter. The list stays filtered on the old query even though the input is empty. The root cause is that Cmd+Delete is a macOS line-kill that the terminal/input widget handles internally — it updates the input's content without firing the `onInput` event that `DialogSelect` relies on to sync filter state. The fix adds an onContentChange handler alongside onInput. onContentChange fires whenever the input widget's underlying edit buffer changes, regardless of how it changed, so it catches Cmd+Delete. It reads the actual input.value and updates the filter. A dedup guard (`if (value === store.filter) return`) prevents redundant updates during normal typing where both events fire. This pattern is already used in the prompt input component (`packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx`). ### How did you verify your code works? Ran `bun dev` from source, tested with 2 different `DialogSelect` inputs (model picker and connect a new provider): typed a query to filter the list, then pressed Cmd+Delete. The input cleared and the list immediately returned to the unfiltered state.
yindo added the pull-request label 2026-02-16 18:19:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14265