[PR #6664] Fix keybind parse missing super:false #12028

Closed
opened 2026-02-16 18:16:57 -05:00 by yindo · 0 comments
Owner

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

State: closed
Merged: No


The fix is complete. Here's a summary of the changes:

Summary

Root Cause: When parsing keybind strings like "ctrl+u", the Keybind.parse function was creating Info objects without a super field (it was undefined). This caused issues when these keybinds were passed to OpenTUI's textarea, where the missing super field (undefined) was interpreted differently than super: false, leading to unintended keybind conflicts.

The Fix:

  1. In packages/opencode/src/util/keybind.ts (line 67): Added super: false to the initial info object in the parse function. This ensures that all parsed keybinds explicitly have super: false unless they specifically include the "super" modifier in their keybind string.

  2. Updated all 15 test cases in packages/opencode/test/keybind.test.ts to include super: false in their expected results, ensuring the tests accurately reflect the new behavior.

Why this fixes the issue: When a user configures messages_half_page_up: "ctrl+u", the parsed keybind now explicitly has super: false. When this keybind is passed to OpenTUI's textarea via mapTextareaKeybindings, the super: false || undefined expression evaluates to undefined, but more importantly, OpenTUI now receives a consistent set of keybindings where the super modifier is always explicitly defined. This prevents cmd+backspace (which is super+backspace) from being incorrectly matched against keybinds that don't use the super modifier.

Closes #6650

New%20session%20-%202026-01-02T17%3A57%3A48.718Z
opencode session  |  github run

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6664 **State:** closed **Merged:** No --- The fix is complete. Here's a summary of the changes: ## Summary **Root Cause:** When parsing keybind strings like `"ctrl+u"`, the `Keybind.parse` function was creating `Info` objects without a `super` field (it was `undefined`). This caused issues when these keybinds were passed to OpenTUI's textarea, where the missing `super` field (undefined) was interpreted differently than `super: false`, leading to unintended keybind conflicts. **The Fix:** 1. In `packages/opencode/src/util/keybind.ts` (line 67): Added `super: false` to the initial `info` object in the `parse` function. This ensures that all parsed keybinds explicitly have `super: false` unless they specifically include the "super" modifier in their keybind string. 2. Updated all 15 test cases in `packages/opencode/test/keybind.test.ts` to include `super: false` in their expected results, ensuring the tests accurately reflect the new behavior. **Why this fixes the issue:** When a user configures `messages_half_page_up: "ctrl+u"`, the parsed keybind now explicitly has `super: false`. When this keybind is passed to OpenTUI's textarea via `mapTextareaKeybindings`, the `super: false || undefined` expression evaluates to `undefined`, but more importantly, OpenTUI now receives a consistent set of keybindings where the `super` modifier is always explicitly defined. This prevents `cmd+backspace` (which is `super+backspace`) from being incorrectly matched against keybinds that don't use the super modifier. Closes #6650 <a href="https://opencode.ai/s/r3uS6Ny3"><img width="200" alt="New%20session%20-%202026-01-02T17%3A57%3A48.718Z" src="https://social-cards.sst.dev/opencode-share/TmV3IHNlc3Npb24gLSAyMDI2LTAxLTAyVDE3OjU3OjQ4LjcxOFo=.png?model=opencode/claude-opus-4-5&version=1.0.223&id=r3uS6Ny3" /></a> [opencode session](https://opencode.ai/s/r3uS6Ny3)&nbsp;&nbsp;|&nbsp;&nbsp;[github run](/sst/opencode/actions/runs/20663555496)
yindo added the pull-request label 2026-02-16 18:16:57 -05:00
yindo closed this issue 2026-02-16 18:16:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12028