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!