Command backspace not working from 1.0 #2504

Closed
opened 2026-02-16 17:36:01 -05:00 by yindo · 5 comments
Owner

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

Originally assigned to: @kommander on GitHub.

Description

command backspace doesn't work to delete a line anymore

OpenCode version

1.0.12

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

macOS 26.0.1

Terminal

Ghostty

Originally created by @knotbin on GitHub (Nov 2, 2025). Originally assigned to: @kommander on GitHub. ### Description command backspace doesn't work to delete a line anymore ### OpenCode version 1.0.12 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System macOS 26.0.1 ### Terminal Ghostty
yindo added the opentuibug labels 2026-02-16 17:36:01 -05:00
yindo closed this issue 2026-02-16 17:36:01 -05:00
Author
Owner

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

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

  • #3749: Similar Command+backspace issue on macOS 26.0.1 with Ghostty - user also reports that Command+backspace used to delete a line but nothing happened after updating to 1.0
  • #3774: Key events not being consumed properly in opentui - broader keyboard input handling issues in the new TUI

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: - #3749: Similar Command+backspace issue on macOS 26.0.1 with Ghostty - user also reports that Command+backspace used to delete a line but nothing happened after updating to 1.0 - #3774: Key events not being consumed properly in opentui - broader keyboard input handling issues in the new TUI Feel free to ignore if none of these address your specific case.
Author
Owner

@PranshuRaj1 commented on GitHub (Nov 3, 2025):

Hello! I've been investigating this issue (#3783) and I think I've narrowed down the root cause.

The original reporter is on macOS, but I can confirm this is a wider problem, as I'm on Windows and can reproduce a similar bug, Ctrl+Backspace only deletes one character (it's ignoring the Ctrl key).
This suggests the new input component isn't handling modifier keys correctly.

I looked into the opencode TUI code to see if I could find the onKeyDown logic, starting in packages/opencode/src/cli/cmd/tui/ as per the CONTRIBUTING.md.
I found the Prompt component, which renders the . In its onKeyDown handler, I noticed it only intercepts specific, custom keybinds:</p> <div data-attr-class="d36XGXEeAQZnv8MH:code-block-container code-overflow-scroll"><pre data-attr-class="d36XGXEeAQZnv8MH:code-block"><code data-attr-class="d36XGXEeAQZnv8MH:chroma language-text display"><textarea // ... onKeyDown={async (e: KeyEvent) => { // ... // It correctly matches custom keybinds: if (keybind.match("input_clear", e) && store.prompt.input !== "") { // ... } if (keybind.match("input_forward_delete", e) && store.prompt.input !== "") { // ... } // ... // BUT: There is no handler for a raw "backspace" key press. }} // ... /> </code></pre></div><p dir="auto">Since there's no if (e.name === "backspace") block, the default backspace behavior is being handled by the <textarea> component itself.<br> This strongly suggests the bug is not in the opencode codebase, but in the underlying @opentui/core library that provides the <textarea> component.<br> It seems the TextareaRenderable from @opentui/core doesn't have the logic to handle event.ctrlKey, event.altKey, or event.metaKey in combination with the backspace key.<br> Could a maintainer confirm if this is the correct place to look? If so, I'm willing to continue the investigation over in the sst/opentui repository.</p> <p dir="auto">Thanks!</p> </body></html>

@PranshuRaj1 commented on GitHub (Nov 3, 2025): Hello! I've been investigating this issue (#3783) and I think I've narrowed down the root cause. The original reporter is on macOS, but I can confirm this is a wider problem, as I'm on Windows and can reproduce a similar bug, Ctrl+Backspace only deletes one character (it's ignoring the Ctrl key). This suggests the new input component isn't handling modifier keys correctly. I looked into the opencode TUI code to see if I could find the onKeyDown logic, starting in packages/opencode/src/cli/cmd/tui/ as per the CONTRIBUTING.md. I found the Prompt component, which renders the <textarea>. In its onKeyDown handler, I noticed it only intercepts specific, custom keybinds: ``` <textarea // ... onKeyDown={async (e: KeyEvent) => { // ... // It correctly matches custom keybinds: if (keybind.match("input_clear", e) && store.prompt.input !== "") { // ... } if (keybind.match("input_forward_delete", e) && store.prompt.input !== "") { // ... } // ... // BUT: There is no handler for a raw "backspace" key press. }} // ... /> ``` Since there's no if (e.name === "backspace") block, the default backspace behavior is being handled by the <textarea> component itself. This strongly suggests the bug is not in the opencode codebase, but in the underlying @opentui/core library that provides the <textarea> component. It seems the TextareaRenderable from @opentui/core doesn't have the logic to handle event.ctrlKey, event.altKey, or event.metaKey in combination with the backspace key. Could a maintainer confirm if this is the correct place to look? If so, I'm willing to continue the investigation over in the sst/opentui repository. Thanks!
Author
Owner

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

Newer versions of opentui/opencode should use kitty keyboard at least, but Ghostty does not support kitty keyboard and emits "\u0015" which is ctrl+u for cmd+backspace.

@kommander commented on GitHub (Nov 17, 2025): Newer versions of opentui/opencode should use kitty keyboard at least, but Ghostty does not support kitty keyboard and emits "\\u0015" which is `ctrl+u` for `cmd+backspace`.
Author
Owner

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

So this can only have worked in earlier versions if ctrl+u was mapped to delete line.

@kommander commented on GitHub (Nov 17, 2025): So this can only have worked in earlier versions if `ctrl+u` was mapped to delete line.
Author
Owner

@knotbin commented on GitHub (Nov 17, 2025):

this actually works now. not exactly the same functionality as it was before but it's functional now

@knotbin commented on GitHub (Nov 17, 2025): this actually works now. not exactly the same functionality as it was before but it's functional now
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2504