fix(tui): fix Shift+Enter newline on Windows #8040
Open
+30
−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.
What does this PR do?
Video
Fixes #8038
Summary
Fixes Windows prompt behavior where
Shift+Enterwas treated likeEnter(submitting) instead of inserting a newline, restoring the intended “newline vs submit” UX.Details
Shift+Entercan be delivered as an unmodifiedreturnkey event, so it matches the textarea’sreturn → submitbinding (same path as plainEnter).packages/opencode/src/cli/cmd/tui/context/keybind.tsx:user32.dllviabun:ffiand callGetAsyncKeyState(VK_SHIFT)(VK_SHIFT = 0x10).evt.name === "return"evt.shift/ctrl/meta/super/hyperall falseGetAsyncKeyStateindicates Shift is currently down (state & 0x8000)evt.shift = truebefore matching keybinds.returnevents with no other modifiers and only onprocess.platform === "win32", so the change is intentionally limited to the broken case.How did you verify your code works?
Shift+Enter, submit withEnter).bun run typecheck(repo typecheck via the pre-push hook /turbo typecheck).