Repository navigation
Conversation
Korean typed on an iPad with a hardware keyboard reaches the terminal as
loose jamo: 한글 arrives as ㅎㅏㄴㄱㅡㄹ. The same keystrokes compose
correctly in an ordinary text field in the same browser on the same
device, so it is not a platform limit.
iPadOS Hangul fires no composition events at all. Each jamo is a plain
keydown, and the IME rewrites the syllable in place in the helper
textarea. The terminal sends the raw jamo from the key path, and the
composed syllable that follows by input event is then rejected because a
key is down for every one of them.
The IME is real, it just does not announce itself, so mirror it: hold
the syllable as a preedit and let the textarea say when it is final. The
commit signal is the shape of the rewrite, which the recorded trace
already carries - while a syllable is still forming the IME replaces it,
and once it is final the next jamo appends. A tail that grew past what
was held is therefore the only signal needed.
ㅎ -> 하 -> 한 held, nothing sent
한ㄱ appended, so 한 commits
한그 -> 한글 held
Enter 글 commits, then the newline
One commit per syllable, no intermediate text on the wire, and no erase
characters - which matters because a full screen application cannot be
assumed to accept them mid-input.
Scoped to touch iOS by user agent and touch points, since every iOS user
agent reports a Mac. Windows and Linux cannot reach the code, desktop
macOS is excluded by touch points, and non-Hangul keys are excluded by
the jamo range. Disabled under screen reader mode, which drives the
textarea itself and would make the diff unreliable; Korean stays broken
there rather than risking input vanishing.
Rendering reuses the existing preedit overlay, so the held syllable
inherits the underline, the row tail and the cursor anchoring the
composition path already has.
Backspace and Escape are handled but unobserved on the device: a
shrinking tail re-renders, an emptied tail ends the hold, and neither
sends a byte, since nothing was sent to undo.
Refs #13345
The first pass held the syllable correctly but still sent every jamo raw. A device trace showed why: the read that re-derives the preedit is armed on a timer, and iPadOS delivers the matching input event later than a macrotask. The timer therefore always fired first, saw a field the IME had not written yet, concluded the key produced nothing, and sent it. Adding a second turn did not help - two timers still beat the write, and a timing constant large enough to win would be a guess. So the timer no longer decides anything. It updates the preedit when there is something to read, and returns otherwise. It does not send, and it does not end the hold either: ending it was equally wrong, because a write arriving afterwards would find no preedit and fall through to the raw key path. The question the timer was guessing at - did this key produce any text - is now answered where it is a fact rather than a race. The input event drives the read, since xterm delivers it for insertText alone, which is exactly when the IME has finished writing. A key that genuinely composed nothing is settled on the next keydown. Refs #13345
📝 WalkthroughWalkthroughThe xterm patch adds transaction-aware composition handling and public IME lifecycle methods. It supports touch-iOS Hangul preedit editing, deferred keypress and textarea input reconciliation, cancellation, blur, disposal, and composition overlay rendering. Core browser integration forwards accepted composition events and suppresses duplicate input. Merge Risk: 🟡 Moderate · up to The change should correctly support Korean Hangul composition on iPadOS, but the current patch has an undeclared variable in the TypeScript source that can prevent compilation. Fix that issue before merging. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
config/patches/xterm-src/@[email protected] (1)
1247-1267: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winDeclare
iinside_deleteAtKey
_deleteAtKeyusesiwithout a local declaration. Addlet i = this._search(key);; otherwise the TypeScript source does not compile.
🧹 Nitpick comments (2)
config/patches/xterm-src/@[email protected] (1)
129-131: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the unused
settledfield fromIHangulKeydownPreedit.No code reads or writes
settled, and its comment describes behavior not implemented by the final state. Remove both the field and its comment.src/renderer/src/components/terminal-pane/terminal-ime-xterm-ipad-hangul-keydown.test.ts (1)
410-413: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
dispatchInputfor the delayed input event.[email protected]preservesdataandinputTypefromInputEventInit, but the inline event leavescomposedfalse.dispatchInputsetscomposed: trueand exercises xterm’s composed-input path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 50766bf3-e9ec-4bcd-872f-5fcc67f551df
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
config/patches/@[email protected]config/patches/xterm-src/@[email protected]src/renderer/src/components/terminal-pane/terminal-ime-xterm-ipad-hangul-keydown.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
|
Holding this — the vendored-xterm-patch approach is disfavoured on maintainability grounds. That patch has to be regenerated through #13346 (community PR by @dvpaa) fixes the same bug by mirroring iOS field edits to the PTY, touching no xterm patch. It is now the front-runner and is under review. If it is correct — or close enough to fix — this PR should be closed in its favour. Keeping this open only until that review lands, since the diagnosis and the device-measured constraints here are worth preserving either way:
|
|
Superseded by #15480, which fixes the same bug without patching the vendored xterm. Two reasons this approach was abandoned rather than merged: It never fixed the reported case. This sits downstream of Orca's own bypass policy, which claims Shift-typed jamo ( The 7MB vendored patch has to be regenerated on every xterm bump, and the renderer layer turned out to be able to do the job — verified point by point: keydown suppression via #15480 is now confirmed working on a physical iPad against a recorded device trace. |
Fixes #13345 — Korean typed on an iPad reached the terminal as separate jamo instead of composed syllables.
Root cause
iPadOS Korean fires zero composition events. No
compositionstart, nocompositionupdate, nocompositionend— just plain keydowns, while the IME rewrites the helper textarea in place (adeleteContentBackwardfollowed by a replacinginsertText). xterm'sCompositionHelperis built entirely around composition events, so it never saw a composition and forwarded each jamo as it arrived.Confirmed on the reporter's hardware, not inferred: Chinese pinyin on the same device does fire composition events normally. It is specific to the Korean input mode.
Fix
CompositionHelpernow holds Hangul jamo keydowns as a preedit and syncs from the textarea, in the patched xterm source.Two device-measured details that shaped it:
isTouchIOS()usesmaxTouchPoints > 1, not> 0. Every iOS user agent contains "Mac" (Macintoshin desktop mode,like Mac OS Xin mobile), so the UA alone cannot separate iPad from Mac.> 0is also wrong — a Mac with a touch peripheral reports 1.input(), not a timer. The first two attempts failed on device._deferissetTimeout(0), and iPadOS deliversinputlater than a macrotask, so any timer-based read raced the IME's write and lost. xterm callsinput()forinsertTextalone, which is exactly when the IME has finished writing the field. The timer now never sends and never ends the hold; stranded keys resolve on the next keydown.Verification
Device-confirmed by the reporter on the final build: typing
gksrmfsends한and correctly holds글as a still-open preedit — committed text out, live syllable retained, which is the desired IME behavior rather than a partial send.420 lines of unit coverage in
terminal-ime-xterm-ipad-hangul-keydown.test.ts.Note on the patch files
Regenerated through
config/scripts/regenerate-xterm-patches.mjs, never hand-edited — thexterm patch syncCI gate enforces that the bundle matches the reviewable source patch. Reviewconfig/patches/xterm-src/@[email protected]; the binary bundle is generated output.