Repository navigation
Conversation
…inal Two ways a committed composition was lost or corrupted. The composition route called preventDefault() before checking whether it owned the session. A route installed mid-composition never saw the matching session start, so it suppressed xterm's own insertion and then returned without delivering anything — the commit vanished. Ownership is now decided first; preventDefault stays for sessions the route does own, including the ones it deliberately drops after a transport swap, since that drop is its decision to make. The deferred-newline fallback fired `finish` directly, bypassing the pending-composition re-check that the event path uses. A composition still open at 200 ms got a newline sent into the middle of its preedit. The deadline now re-arms while a composition is pending, and its 2 s ceiling is measured from the last compositionupdate rather than from the start. A slow candidate window no longer splits the preedit, and neither does multi-segment bunsetsu conversion, which stays legitimately pending well past any fixed total-elapsed ceiling. A composition that stops progressing still cannot strand the keystroke. Co-authored-by: Orca <[email protected]> The re-arm also treats a live compositionupdate as evidence in its own right, not just a session the route recorded. A route installed while a composition was already in flight never saw that session start, so it has nothing to report as pending and the deadline would otherwise split that composition too.
|
Closing as obsolete rather than superseded — this one can't be rebased. All four files it touches ( The deferral mechanism turned out to be the bug, not the fix. On 1.4.171 we could get Orca to write a Shift+Enter payload to the PTY with no Enter pressed — 10/10 deterministic, landing 203-218 ms after keydown, which was the 200 ms fallback firing straight past the pending-composition gate that only the event path checked. #12890 reported the same thing independently from the Japanese/Chinese side, where phrase-level preedits stay open well past that bound. If a commit-splitting case still reproduces on current main, please reopen with a trace and I'll take it from the new baseline. |
Draft — opened to run CI, not to request review. Close it freely; the branch stands alone.
Backports
0ada9368fd5tomain. Two IME defects currently ship onmain; both are closed by this one commit, and the behavioural change for the first is one moved line.1. A committed composition is silently dropped
terminal-ime-composition-route.tscallsevent.preventDefault()before checking whether it owns the session. The patched xterm skips its owntriggerDataEventwhen the session-end event isdefaultPrevented, so a route that never saw the matching session start silences xterm and then returns without delivering anything. The commit vanishes — no error, no partial, no residue.Reachable because the route's lifetime is bound to the PTY connection, not the terminal:
TerminalPane.tsx:1643deliberately keeps the pane mounted across a reconnect, so the composition survives while the route is swapped underneath it.Fix: decide ownership first.
preventDefaultstays for sessions the route genuinely owns, including the ones it deliberately drops after a transport swap.2. Enter is sent into an open preedit
The deferred-newline fallback fires
finishdirectly, bypassing the pending-composition re-check the event path uses, so a composition still open at 200 ms takes a newline into the middle of its preedit. The same module checks whether a composition is open on one path and not the other — that asymmetry is the bug.Fix: re-arm the deadline while a composition is pending, with the idle ceiling measured from the last
compositionupdaterather than from the start, so multi-segment Japanese conversion is not split.Scope — neither defect is Korean-specific
The drop is ownership-specific, not payload-specific: an ASCII payload through the same uncaptured-session path fails identically. Every CJK/IME user on 1.4.163–1.4.165 and on
maintoday is exposed. Korean reporters dominate only because 2-Set Hangul composes on nearly every keystroke.Verification
origin/mainwith zero conflicts;terminal-ime-composition-route.ts's blob onmainis byte-identical to the fix's parent, and the deferred-newline file auto-merges.setTimeout(finish, fallbackMs)gone,main's latercodeguard retained,preventDefault()now after the ownership check.v1.4.163fails, fixed passes — so nothing depends on scratch state.What it does not touch
No change to the xterm patch,
pty-connection.ts, or anything undersrc/main/daemon/. No dependency, lockfile or build change. The route's deliberate drops after a transport swap are unchanged, by design.Made with Orca 🐋