opentui: bug: Selecting a model by pressing enter also send message in chat #2498

Closed
opened 2026-02-16 17:35:57 -05:00 by yindo · 6 comments
Owner

Originally created by @Mishkun on GitHub (Nov 2, 2025).

Originally assigned to: @kommander on GitHub.

Description

I think that key events are not consumed properly in opentui by the handlers

OpenCode version

v1.0.11

Steps to reproduce

  1. launch opencode
  2. type something in chatbox
  3. launch model selector ctrl+x m
  4. select any model by pressing enter

Result: model is selected and message is sent to it

expected result: model is selected, message stays unsent and editable

Screenshot and/or share link

No response

Operating System

macos

Terminal

iterm2

Originally created by @Mishkun on GitHub (Nov 2, 2025). Originally assigned to: @kommander on GitHub. ### Description I think that key events are not consumed properly in opentui by the handlers ### OpenCode version v1.0.11 ### Steps to reproduce 1. launch opencode 2. type something in chatbox 3. launch model selector ctrl+x m 4. select any model by pressing enter Result: model is selected and message is sent to it expected result: model is selected, message stays unsent and editable ### Screenshot and/or share link _No response_ ### Operating System macos ### Terminal iterm2
yindo added the opentuibug labels 2026-02-16 17:35:57 -05:00
yindo closed this issue 2026-02-16 17:35:57 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 2, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #3713: Very similar issue where pressing Enter in model selector (leader+m) causes message to be sent immediately instead of just selecting the model

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Nov 2, 2025): This issue might be a duplicate of existing issues. Please check: - #3713: Very similar issue where pressing Enter in model selector (leader+m) causes message to be sent immediately instead of just selecting the model Feel free to ignore if none of these address your specific case.
Author
Owner

@Mishkun commented on GitHub (Nov 2, 2025):

still reproducable on 06ac1be226

pressed enter 1 time

https://github.com/user-attachments/assets/89b024c5-3c77-4abf-98a3-7641d749ce4d

@Mishkun commented on GitHub (Nov 2, 2025): still reproducable on 06ac1be226555c1d562a26de9c64dd64e3926275 pressed enter 1 time https://github.com/user-attachments/assets/89b024c5-3c77-4abf-98a3-7641d749ce4d
Author
Owner

@thdxr commented on GitHub (Nov 2, 2025):

@kommander i am doing preventDefault() in the input for dialog-select but i think textarea triggers keybinds anyway

@thdxr commented on GitHub (Nov 2, 2025): @kommander i am doing preventDefault() in the input for dialog-select but i think textarea triggers keybinds anyway
Author
Owner

@kommander commented on GitHub (Nov 2, 2025):

That worked until recently, I can reproduce. Need to check.

@kommander commented on GitHub (Nov 2, 2025): That worked until recently, I can reproduce. Need to check.
Author
Owner

@kommander commented on GitHub (Nov 2, 2025):

@thdxr the "Submit prompt" command is triggered by the global keybind.

{
  title: "Submit prompt",
  value: "prompt.submit",
  disabled: true,
  keybind: "input_submit",
  category: "Prompt",
  onSelect: (dialog) => {
    submit()
    dialog.clear()
  },
},

In the config.ts:

input_submit: z.string().optional().default("return").describe("Submit input"),

The keybind.tsx listener is global and triggers that command it seems.

@kommander commented on GitHub (Nov 2, 2025): @thdxr the "Submit prompt" command is triggered by the global keybind. ```ts { title: "Submit prompt", value: "prompt.submit", disabled: true, keybind: "input_submit", category: "Prompt", onSelect: (dialog) => { submit() dialog.clear() }, }, ``` In the config.ts: ```ts input_submit: z.string().optional().default("return").describe("Submit input"), ``` The `keybind.tsx` listener is global and triggers that command it seems.
Author
Owner

@thdxr commented on GitHub (Nov 2, 2025):

^ yep fixed now

@thdxr commented on GitHub (Nov 2, 2025): ^ yep fixed now
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2498