summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoe Harrison <[email protected]>2026-01-13 15:06:38 -0500
committerFrank <[email protected]>2026-01-13 19:51:01 -0500
commit1fccb3bda443d37e8f940c85caeb10c55c44425b (patch)
tree8bc88d4b71c4d07f70f895bc4c0f833a47daffc7
parent16b2bfa8ef0b3ea9bbe9d469bd48d47eaf108955 (diff)
downloadopencode-1fccb3bda443d37e8f940c85caeb10c55c44425b.tar.gz
opencode-1fccb3bda443d37e8f940c85caeb10c55c44425b.zip
fix(prompt-input): handle Shift+Enter before IME check to prevent stuck state (#8275)
-rw-r--r--packages/app/src/components/prompt-input.tsx20
1 files changed, 15 insertions, 5 deletions
diff --git a/packages/app/src/components/prompt-input.tsx b/packages/app/src/components/prompt-input.tsx
index f1ca3ee88..2f85652a9 100644
--- a/packages/app/src/components/prompt-input.tsx
+++ b/packages/app/src/components/prompt-input.tsx
@@ -364,6 +364,12 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
if (!isFocused()) setStore("popover", null)
})
+ // Safety: reset composing state on focus change to prevent stuck state
+ // This handles edge cases where compositionend event may not fire
+ createEffect(() => {
+ if (!isFocused()) setComposing(false)
+ })
+
type AtOption = { type: "agent"; name: string; display: string } | { type: "file"; path: string; display: string }
const agentList = createMemo(() =>
@@ -881,6 +887,14 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
}
}
+ // Handle Shift+Enter BEFORE IME check - Shift+Enter is never used for IME input
+ // and should always insert a newline regardless of composition state
+ if (event.key === "Enter" && event.shiftKey) {
+ addPart({ type: "text", content: "\n", start: 0, end: 0 })
+ event.preventDefault()
+ return
+ }
+
if (event.key === "Enter" && isImeComposing(event)) {
return
}
@@ -944,11 +958,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
return
}
- if (event.key === "Enter" && event.shiftKey) {
- addPart({ type: "text", content: "\n", start: 0, end: 0 })
- event.preventDefault()
- return
- }
+ // Note: Shift+Enter is handled earlier, before IME check
if (event.key === "Enter" && !event.shiftKey) {
handleSubmit(event)
}