Fix keybind parse missing super:false #6664
Open
+17
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The fix is complete. Here's a summary of the changes:
Summary
Root Cause: When parsing keybind strings like
"ctrl+u", theKeybind.parsefunction was creatingInfoobjects without asuperfield (it wasundefined). This caused issues when these keybinds were passed to OpenTUI's textarea, where the missingsuperfield (undefined) was interpreted differently thansuper: false, leading to unintended keybind conflicts.The Fix:
In
packages/opencode/src/util/keybind.ts(line 67): Addedsuper: falseto the initialinfoobject in theparsefunction. This ensures that all parsed keybinds explicitly havesuper: falseunless they specifically include the "super" modifier in their keybind string.Updated all 15 test cases in
packages/opencode/test/keybind.test.tsto includesuper: falsein 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 hassuper: false. When this keybind is passed to OpenTUI's textarea viamapTextareaKeybindings, thesuper: false || undefinedexpression evaluates toundefined, but more importantly, OpenTUI now receives a consistent set of keybindings where thesupermodifier is always explicitly defined. This preventscmd+backspace(which issuper+backspace) from being incorrectly matched against keybinds that don't use the super modifier.Closes #6650
opencode session | github run