Skip to content

[Bug]: Desktop terminal drops the last Hangul syllable onto a new line on Enter (missing isComposing guard, macOS) #8038

Closed

Description

@baekstrong

Summary

On the desktop terminal (xterm.js), pressing Enter while a Hangul (Korean) syllable is still being composed causes the trailing syllable to be pushed onto a new line instead of being committed inline before the newline. This looks like a missing isComposing / keyCode === 229 guard on the terminal's Enter handling — the same class of bug already fixed for other input surfaces in #6980 (rename inputs) and #742 (workflow popup), but still present in the desktop terminal itself.

This is desktop-specific and distinct from the mobile Korean IME issues (#7183 / #7182 / #7000), which live in mobile/src/terminal/* (React Native). Here the affected surface is the xterm.js terminal in the desktop app.

Environment

  • Orca: v1.4.131 (desktop, macOS)
  • OS: macOS (Darwin 25.5.0), Apple Silicon
  • IME: 2-Set Korean (두벌식) — the default macOS Korean input source
  • Surface: desktop terminal pane (xterm.js). English/ASCII input is unaffected.

Steps to reproduce

  1. Switch the macOS input source to Korean (2-Set / 두벌식).
  2. Focus a terminal pane in the desktop app.
  3. Type a few Korean syllables, e.g. 하 하 하, so the last syllable is still in IME composition (marked/underlined, not yet committed).
  4. Press Enter.

Expected

The full composed text is committed inline, then a single newline is sent — i.e. Enter should first flush the pending composition (compositionend), then submit. The trailing syllable stays on the same line as the rest of the command.

Actual

The trailing syllable is separated onto a new line. Visually:

> 하 하
  하▮        ← last syllable leaked onto the next line after Enter

The \r (newline) appears to be sent while the IME composition is still active, so the compositionend commit of the last syllable races/lands after the newline instead of before it.

Root cause hypothesis

The terminal's key handling does not suppress/defer Enter while KeyboardEvent.isComposing is true (equivalently keyCode === 229 during composition). It should not emit the carriage return until the pending composition has been committed. This is the identical failure mode described in:

Those were fixed by guarding Enter on isComposing; the desktop terminal path appears to have been missed. (Also related in spirit: #6905 Vietnamese IME in terminal.)

Workaround (for other users hitting this)

Commit the composition before pressing Enter using anything that isn't Enter — e.g. finish typing, tap 한/영 (Caps Lock) to switch the input source to English (which commits the pending syllable), then press Enter. Enter then fires with no active composition and submits cleanly.

Notes

  • A screenshot reproducing the > 하 하 / 하 split is available and can be attached on request.
  • Repro is 100% consistent whenever the final character before Enter is an uncommitted Hangul syllable.

Activity

  1. added theissue type on Jul 12, 2026
  2. sanghunka commented on Jul 16, 2026

    @sanghunka

    Couldn't reproduce on my end(same env).

    It actually only happens when I press Shift+Enter instead of just Enter.

    @baekstrong Was it Shift+Enter or just Enter that you hit?

  3. baekstrong commented on Jul 16, 2026

    @baekstrong
    Author

    I pressed shift+enter to add a line break.
    can you fix this??

  4. sanghunka commented on Jul 16, 2026

    @sanghunka

    Ah, then this issue duplicates #8578.
    It's being addressed there

  5. nwparker commented on Jul 27, 2026

    @nwparker
    Contributor

    Screenshot / short recording needed

    Desktop terminal drops the last Hangul syllable onto a new line on Enter (isComposing missing). Visual evidence:

    1. Before Enter: composing Hangul syllable visible on the current line.
    2. After Enter: that syllable jumps/duplicates onto a new line incorrectly.
    3. Optional: same sequence in an external terminal (iTerm/Terminal.app) for contrast.

    Include macOS version, keyboard input source (2-Set Korean / etc.), and Orca version.

  6. nwparker commented on Jul 27, 2026

    @nwparker
    Contributor

    Attempted repro — cannot_repro

    Tried

    1. Code path review of desktop terminal IME handling (xterm-bypass-policy.ts, terminal-ime-*, custom key handler in use-terminal-pane-lifecycle.ts).
    2. Confirmed Enter is in TERMINAL_IME_OWNED_KEYS and is suppressed when compositionActive / isComposing is true.
    3. Related PR Fix CJK IME newline: defer Shift/Ctrl+Enter until composition commits #8578 (CJK IME newline / Shift-Ctrl+Enter) is closed unmerged.
    4. No Hangul 2-Set IME UI session available in this agent environment to capture the visual “last syllable on next line” race end-to-end.

    Result

    Could not produce conclusive UI evidence of the Hangul Enter split on this host. Policy-level code appears to suppress Enter during composition; if the bug still reproduces, it likely lives in xterm CompositionHelper commit ordering rather than a missing isComposing guard on Orca’s custom handler. Needs a manual Hangul IME pass on macOS desktop.

  7. added
    pending_reproRepro attempted; still pending conclusive reproduction
    on Jul 27, 2026
  8. ethznn commented on Jul 29, 2026

    @ethznn
    Contributor

    I can still reproduce this on Orca 1.4.156.

    • macOS 26.5.2, Apple Silicon
    • macOS Korean 2-Set IME
    • Reproduces in both Codex CLI and Claude Code
    • Also reproduces with regular input in the Orca terminal
    • Does not reproduce in iTerm2 with the same Korean IME

    While the final 자 in 마지막 글자 is still under active IME composition, pressing Shift+Enter produces:

    마지막 글
    
    자
    

    In string form:

    Actual:   "마지막 글\n\n자"
    Expected: "마지막 글자\n"
    

    This suggests the issue is in Orca's terminal IME/Shift+Enter handling rather than in a specific CLI agent.

    This also appears to match #10343.

    Screen.Recording.2026-07-29.at.1.38.06.PM.mov

    Here is a short recording showing the reproduction in Orca 1.4.156 and the same input working correctly in iTerm2.

    The final 자 is still under active Korean IME composition when Shift+Enter is pressed.

    I hope this helps with reproducing and diagnosing the issue. Thanks for looking into it!

  9. AmethystLiang commented on Aug 2, 2026

    @AmethystLiang
    Contributor

    Thanks for reporting. Will looking into fixing it.

  10. tonite31 commented on Aug 11, 2026

    @tonite31
    Contributor

    Re-checked this on current-era code, since the confirmed repro above predates the recent IME churn (the composition-ownership change #13128 and its revert #13282).

    Setup: macOS built-in Korean 2-Set, Claude Code composer in the integrated terminal, on a build tracking upstream main at e172a5164 (2026-08-08; terminal/IME input path is unmodified upstream code). Ran the exact sequence from the confirmed repro — type 마지막 글자, keep the final 자 in active composition, press Shift+Enter.

    Result: no split. The line stays intact and the newline lands after it — not the 마지막 글 / blank line / 자 shape reproduced on 1.4.156 above.

    So this looks fixed somewhere between 1.4.156 and e172a5164; I can't bisect which change did it from here. If anyone still hits it, worth stating the exact version — and if it reproduces on ≥ 1.4.177, that would separate it from the pre-revert composition code. Same symptom family as #10343, which this result covers too.

  11. nwparker commented on Aug 15, 2026

    @nwparker
    Contributor

    Fixed on main — same root cause as #10343.

    Your diagnosis was right: the newline was being sent while the syllable was still composing. Terminal shortcuts now wait for the composition to commit before their bytes go out (fe6f929c6e3, plus 8af6876510d / ca9562ceee7).

    Your original repro was on 1.4.156, which predates the fix, and you re-tested clean afterwards. Thanks for both.

    Reopen with a build number if it comes back.

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 workingos:macosIssues affecting macOSpending_reproRepro attempted; still pending conclusive reproductionterminal

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions