Skip to content

Command backspace not working from 1.0 #3783

Closed

Description

@knotbin

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

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 3, 2025
  2. github-actions commented on Nov 3, 2025

    @github-actions
    Contributor

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

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

  3. PranshuRaj1 commented on Nov 3, 2025

    @PranshuRaj1
    Contributor

    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!

  4. kommander commented on Nov 17, 2025

    @kommander
    Contributor

    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.

  5. kommander commented on Nov 17, 2025

    @kommander
    Contributor

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

  6. knotbin commented on Nov 17, 2025

    @knotbin
    Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions