Skip to content

[Bug] Korean CJK IME issue with Shift + Enter (Last character moves to a new line) #10343

Closed

Description

@orca-discord-issues

Chris C Chris C via Discord

Summary:
When typing in Korean (CJK IME) inside a Claude Code session on macOS in Orca terminal, pressing Shift + Enter to insert a newline intermittently causes the last uncommitted character to break and shift onto the new line.

Environment:

OS: macOS

Terminal: Orca Terminal

Tool: Claude Code CLI

Input Method: Korean (macOS Default IME)

Steps to Reproduce:

Open Orca terminal on macOS and launch a Claude Code session.

Switch input language to Korean.

Type a sentence in Korean (e.g., "이거를 진행해줘").

Without hitting Space or Enter to finalize the last character ("줘"), press Shift + Enter to make a line break.

Expected Behavior:
The line break occurs smoothly while keeping the text intact:
이거를 진행해줘
[cursor]

Actual Behavior (Intermittent):
The uncommitted last character gets detached and pushed down to the new line:
이거를 진행해
[one blank line]
줘

Additional Context:
This appears to be an issue with how CJK IME compositions (uncommitted text buffer) are handled when a key combination like Shift + Enter is pressed. Shift + Enter should ideally commit the current IME composition first before inserting the newline character.

Activity

  1. added
    pending_reproRepro attempted; still pending conclusive reproduction
    on Jul 27, 2026
  2. deleted a comment from nwparker on Jul 27, 2026
  3. sybdark commented on Jul 31, 2026

    @sybdark

    Reproduced on Windows 11 (so this is not macOS-specific), and I think I can pin the root cause exactly — it is not in xterm.js, it is in Orca's own Shift+Enter interceptor.

    Environment

    • Orca 1.4.161 (desktop, Windows 11 Enterprise 26200)
    • Terminal font D2Coding, IME: Microsoft 두벌식 (Korean 2-Set)
    • Surface: desktop terminal pane running Claude Code

    Root cause

    Orca resolves Shift+Enter in its own keydown resolver (from the shipped app.asar, minified):

    if (!e.metaKey && !e.ctrlKey && !e.altKey && e.shiftKey && e.key === "Enter")
      return { type: "sendInput", data: T() && m?.() === "csi-u" || f?.() === true ? "\x1B[13;2u" : "\x1B\r" };
    if (e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey && e.key === "Enter")
      return { type: "sendInput", data: "\x1B[13;5u" };

    and the dispatcher then does:

    if (Rt.type === "sendInput") {
      Me.preventDefault(), Me.stopImmediatePropagation();
      ...sendInput(Rt.data)
    }

    Two things follow:

    1. There is no isComposing / keyCode === 229 guard anywhere in that resolver. I grepped the whole enclosing function region in the shipped bundle: zero occurrences of either. So the branch fires while the IME still holds uncommitted text.

    2. stopImmediatePropagation() means xterm.js never sees the key at all. That matters, because xterm.js's own handler already does the right thing:

    keydown(e) {
      if (this._isComposing || this._isSendingComposition) {
        if (e.keyCode === 20 || 229 || 16 || 17 || 18) return false;
        this._finalizeComposition(false);   // commits the pending Hangul first
      }
      return e.keyCode === 229 ? (this._handleAnyTextareaChanges(), false) : true;
    }

    Because Orca intercepts in the capture phase and stops propagation, CompositionHelper.keydown() → _finalizeComposition() never runs, so the newline reaches the pty before the composition commits. The trailing syllable then lands after the newline. That is exactly the observed 이거를 진행해 / blank / 줘.

    So the fix does not belong in xterm.js — the upstream composition handling is already correct. It belongs in Orca's interceptor.

    Alt+Enter works, and that confirms the mechanism

    The same resolver excludes Alt explicitly (!e.altKey), and there is no handler in the bundle that claims Alt+Enter. So Alt+Enter is not intercepted: it falls through to xterm.js, which finalizes the composition first and then emits \x1B\r — which Claude Code treats as a newline just like \x1B[13;2u.

    Result: Alt+Enter never truncates Hangul, Shift+Enter intermittently does. It is a usable workaround today, and it isolates the bug to Orca's interceptor rather than to the IME, the font, or the agent CLI.

    Side observation: Alt+Enter also feels snappier, which is consistent — Shift+Enter takes the detour through the resolver, active-pane lookup and sendInput (plus a requestDroidReconfirmation?.() call on the \x1B[13;2u branch), while Alt+Enter goes straight out through xterm.js's normal data path.

    Suggested fix

    Add the composition guard to the Enter branches, e.g.:

    if (!e.isComposing && e.keyCode !== 229 && !e.metaKey && !e.ctrlKey && !e.altKey && e.shiftKey && e.key === "Enter") { ... }

    and the same for the Ctrl+Enter → \x1B[13;5u branch. If Shift+Enter should still insert a newline mid-composition rather than being swallowed, the alternative is to defer the sendInput until after compositionend fires so the ordering is commit-then-newline.

    Related

  4. tonite31 commented on Aug 11, 2026

    @tonite31
    Contributor

    Re-checked the Shift+Enter-mid-composition split on current-era code — full result on the sibling issue: #8038 (comment)

    Short version: macOS built-in 2-Set, Claude Code composer, build tracking upstream main at e172a5164 (2026-08-08, unmodified terminal/IME path). Final syllable held in composition + Shift+Enter → no split; the line stays intact with the newline after it. Looks fixed between 1.4.156 (last confirmed repro on #8038) and e172a5164. If it still reproduces for anyone on ≥ 1.4.177, the exact version would be the useful next data point.

  5. nwparker commented on Aug 15, 2026

    @nwparker
    Contributor

    Fixed on main.

    A resolved terminal shortcut is now held until the composition actually commits — keyboard-handlers.ts routes it through the deferred-newline path whenever isComposing or a composition session is still pending, so Shift+Enter can no longer land ahead of the syllable you were still assembling. Landed in fe6f929c6e3, with follow-ups in 8af6876510d and ca9562ceee7.

    Confirmed on the thread against a build carrying it — no split. Thanks for the report and for re-testing.

    If you still see it on a current build, reopen with the build number and I'll take another look.

  6. nwparker commented on Aug 15, 2026

    @nwparker
    Contributor

    Fixed on main.

    A resolved terminal shortcut is now held until the composition actually commits, so Shift+Enter can no longer land ahead of the syllable you were still assembling. Landed in fe6f929c6e3, with follow-ups in 8af6876510d and ca9562ceee7.

    Confirmed on the thread against a build carrying it — no split. Thanks for the report and for re-testing.

    Reopen with a build number if you still see it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions