Skip to content

Commit 63035f9

Browse files
claudianusrekram1-nodesisyphus-dev-ai
authored
fix: enable thinking for zhipuai-coding-plan & prevent Korean IME truncation (#22041)
Co-authored-by: claudianus <claudianus@users.noreply.github.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent 514d2a3 commit 63035f9

5 files changed

Lines changed: 189 additions & 61474 deletions

File tree

packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,13 @@ export function Prompt(props: PromptProps) {
589589
])
590590

591591
async function submit() {
592+
// IME: double-defer may fire before onContentChange flushes the last
593+
// composed character (e.g. Korean hangul) to the store, so read
594+
// plainText directly and sync before any downstream reads.
595+
if (input && !input.isDestroyed && input.plainText !== store.prompt.input) {
596+
setStore("prompt", "input", input.plainText)
597+
syncExtmarksWithPromptParts()
598+
}
592599
if (props.disabled) return
593600
if (autocomplete?.visible) return
594601
if (!store.prompt.input) return
@@ -994,7 +1001,11 @@ export function Prompt(props: PromptProps) {
9941001
input.cursorOffset = input.plainText.length
9951002
}
9961003
}}
997-
onSubmit={submit}
1004+
onSubmit={() => {
1005+
// IME: double-defer so the last composed character (e.g. Korean
1006+
// hangul) is flushed to plainText before we read it for submission.
1007+
setTimeout(() => setTimeout(() => submit(), 0), 0)
1008+
}}
9981009
onPaste={async (event: PasteEvent) => {
9991010
if (props.disabled) {
10001011
event.preventDefault()

0 commit comments

Comments
 (0)