Repository navigation
Conversation
|
Thanks for carrying the commit with authorship preserved, and no objection at all to folding my tests into One thing to pull in: this branch carries The problem is that I verified it directly against this branch rather than assuming. Applying this PR's diff onto Cherry-picking The follow-up tracks one entry per press instead of one slot per code and drains exactly one per physical release, so every press stays guarded until its own release. Balancing-keyup semantics are unchanged. Two details that are new surface: auto-repeat keydowns deliberately do not stack an entry (a repeat run ends in a single release, so stacking would leave residue that release cannot drain and would suppress a later legitimate keyup-only synthesis), and the list is bounded at 8 so a press whose release never arrives cannot grow it without end. It ships with two regression tests, the first of which fails on Unrelated heads-up on this branch: Environment for all of the above: Windows, Happy for this to be the branch that lands — I'd rather one combined fix ship than have my PR land separately. I also have a Windows 11 + Microsoft Korean IME (2-set) machine reproducing daily with Claude Code and Codex, so if you push an adhoc branch build (#12051) I can run the real-device pass on this exact combination and report back. |
|
Verified and applied — thank you, both for the follow-up and for the trace.
Two keydowns overwrite the single slot, the first release finds a mismatched timeStamp and drops the only entry, and the second release is then unguarded. Real hole, and mine to have missed in review. Cherry-picked with The trace. I turned it into two regression tests, both of which fail on
Your follow-up narrowing the rule to "is a composition already open when Shift goes down" is in as three more, and the word-initial one is the valuable half — it passes on That is the split you described, reproduced independently: All five carry a On the xterm suite failing for you — your own diagnosis is right, and I can confirm it from this side. The two tests you named are the ones commits 5 and 6 add, and they exercise the patched Focused suite on this branch is now 158 passing across the six terminal-pane files, rebased onto On the adhoc build: yes please, that would close the biggest gap in this PR. Everything I have is either unit-level or from a browser harness I built around the real patched xterm — genuine IME events, but no PTY and no Electron. I will ping you here once a build exists. And to be explicit, since you asked me not to close mine: I am not asking you to close yours either. If a maintainer prefers landing the keyup half separately, that is a good outcome and this branch rebases onto it without trouble. |
Adapted from stablyai#11937 commit c865c0b; tests were folded into the existing colocated suite.
Ports only the fallback re-arm portion of stablyai#11896 commit ab2bf67; transport-routing changes are intentionally excluded. Co-authored-by: Neil <[email protected]>
Adapted from stablyai#11870 commit 38bb638.
Adapted from stablyai#11870 commit 2a087c9.
A Shift-jamo consumed as Process/229, the plain committing Enter that follows, and the rollover Shift for the next doubled consonant exercise the stablyai#11616 and stablyai#11937 fixes in one session. Each half was covered separately; this fails on main and passes here.
A single slot per code let a rapid second Enter press go unguarded: the first release found a mismatched timeStamp, dropped the only entry, and the second release then synthesized the Shift+Enter this guard exists to prevent. Track one entry per press and drain exactly one per physical release, so every press stays guarded until its own release. Auto-repeat keydowns do not stack an entry, since the whole run ends in one release, and the list is bounded so a press whose release never arrives cannot grow it without end. Adapted from stablyai#11937 commit e17d22c; tests were folded into the existing colocated suite. Refs stablyai#11878
A window-capture of Windows 11 Pro 26200 + Microsoft Korean IME 2-beolsik typing 있다 on Orca 1.4.163, with no Enter pressed at any point. Two properties it measures rather than assumes: every IME-consumed key arrives as Process/229 while code still carries the physical key, and Windows reports the Shift press itself the same way -- so the pre-fix predicate read a bare Shift as a chord and a mid-composition Shift press alone was enough to inject a newline, with no jamo involved. Both cases send one spurious \x1b\r on main and none here. Trace captured and shared by KimYounghwan8750 in stablyai#11878. Co-authored-by: KimYounghwan8750 <[email protected]>
…tures The trigger is not Shift+jamo but whether a composition session is already open when Shift goes down. Three measured states separate a fix that only satisfies a word-initial jamo from one that holds for ordinary prose: word-initial shifted jamo must stay silent (it already does, and must keep doing so), Shift pressed mid-composition must not inject, and a shifted batchim must not inject. Korean past tense is 았/었/였, so the batchim case is mid-composition by construction and covers a large share of real sentences. Also replays a full 있다 capture that contains no Enter event at all. The word-initial case passes on main and here; the rest send one spurious \x1b\r on main and none here. These live in their own colocated file because folding them into keyboard-handlers-ime.test.tsx pushed it past the 800-line max-lines ratchet. Captures measured and contributed by KimYounghwan8750 in stablyai#11878. Co-authored-by: KimYounghwan8750 <[email protected]>
|
Attribution is exactly right, thank you — and reproducing the double-press case before taking it rather than trusting my description is the right instinct. No changes wanted there. One correction, since you asked. In
A new real-device finding, from the same probe. The trigger is not Shift-specific. Pressing Ctrl mid-composition is reported the same way: Same physical key, two different reports depending only on whether a composition is open — which is a clean paired control for the whole mechanism. Nothing was visible on screen in Claude Code, and I think that is expected rather than evidence of no injection: unlike the Shift+Enter branch, the Ctrl+Enter branch has no Your On the PTY gap. You do not have to wait for an adhoc build for that half. I have Electron and a real PTY on 1.4.163 right now, so I can give you byte-level confirmation of what actually reaches the shell — running a raw-mode reader in a pane and typing Korean, so an injected |
The mechanism is not Shift-specific. Ctrl pressed while a composition is open is reported as Process/229 the same way, getTerminalImeModifiedEnterKind returns 'ctrl' for it, and the pre-fix predicate reached the Ctrl+Enter branch. That branch emits \x1b[13;5u unconditionally with no non-Kitty fallback, so a TUI that has not negotiated the protocol discards it silently -- an injection with nothing visible on screen. On main this case emits [13;5u; here it emits nothing. Also corrects a comment on the batchim case: the events compose 갔 (ㅆ = Shift+t), not 갓, whose plain ㅅ never reaches this path. Probe and correction from KimYounghwan8750 in stablyai#12120. Co-authored-by: KimYounghwan8750 <[email protected]>
3488116 to
2f02f87
Compare
|
You are right about the syllable, thank you — fixed. 갓 takes a plain ㅅ and never reaches The Ctrl finding is real, and I reproduced it before adding it. I built the case from On this branch it emits nothing. That is now a regression test in Your read of why nothing was visible in Claude Code matches what the code says: the On the PTY measurement — yes, please, that is the more valuable half. Everything in this Current state of the branch: rebased onto |
📝 WalkthroughWalkthroughWindows IME handling now tracks composition updates and limits deferred newline fallback by idle time. Process/229 events are recognized as consumed keys only for physical Enter keys. Keyboard shortcuts track observed Enter keydowns, suppress consumed IME events, and clear tracking during focus loss and cleanup. Tests cover real-device Korean traces, modifier rollover, swallowed Enter presses, deferred newline timing, sequential compositions, and Escape cancellation. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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.
Actionable comments posted: 2
🧹 Nitpick comments (2)
src/renderer/src/components/terminal-pane/keyboard-handlers-ime.test.tsx (1)
365-627: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winHarness teardown runs after assertions in both IME test files. Each test calls
hook.unmount()andharness.dispose()as the last statements. A failed assertion skips both, so the composition route stays installed and the scope element stays indocument.body, and one failure can cascade into later tests.
src/renderer/src/components/terminal-pane/keyboard-handlers-ime.test.tsx#L365-L627: track the created harness in a module-scoped variable and dispose it inafterEach, then remove the trailingharness.dispose()calls.src/renderer/src/components/terminal-pane/keyboard-handlers-ime-real-device-trace.test.tsx#L280-L441: apply the sameafterEachdisposal in the existingafterEachat Lines 125-130, and remove the trailingharness.dispose()calls.src/renderer/src/components/terminal-pane/keyboard-handlers-ime-real-device-trace.test.tsx (1)
16-117: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the duplicated
keyboardEventandcreateHarnessinto a shared test module.Lines 16-117 are an exact copy of
keyboardEventandcreateHarnessinsrc/renderer/src/components/terminal-pane/keyboard-handlers-ime.test.tsx(Lines 14-115). Two copies of the harness will drift as the hook's dependency object changes, and each change must then be applied twice.Extraction also serves the stated reason for the split at Line 3: it removes about 100 lines from each file. Give the new module a concrete domain name, for example
keyboard-handlers-ime-test-harness.ts, and not a vague name such ashelpersorshared.The returned
editablefield is also unused in this file; drop it from the call site after extraction.As per coding guidelines: "Do not use vague names such as
helpers,utils,common,misc, orshared-stufffor files, folders, or modules; use concrete domain names instead."Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8155242b-c258-4cb0-91b1-8895da6e57e0
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (7)
config/patches/@[email protected]src/renderer/src/components/terminal-pane/keyboard-handlers-ime-real-device-trace.test.tsxsrc/renderer/src/components/terminal-pane/keyboard-handlers-ime.test.tsxsrc/renderer/src/components/terminal-pane/keyboard-handlers.tssrc/renderer/src/components/terminal-pane/terminal-ime-deferred-newline.test.tssrc/renderer/src/components/terminal-pane/terminal-ime-deferred-newline.tssrc/renderer/src/components/terminal-pane/terminal-ime-xterm-composition-deduplication.test.ts
|
PTY measurement, as promised. Both injections are real at the byte level. Orca 1.4.163, Windows 11 Pro 26200, Microsoft Korean IME 2-beolsik, integrated terminal running a raw-mode reader in a plain PowerShell pane ( What I did, in order, pressing no Enter key at any point:
What the shell received: (The reader printed each chunk with Three things follow from this. The Ctrl variant reaches the shell. Not inferred from the resolver any more — The ordering inversion is visible at the byte level. One thing I cannot yet explain: it fired three times per hold, not once. I expected exactly one per press cycle, because Two candidates I cannot separate from the pty side alone:
Either way it is a real amplifier — holding a modifier is not exotic, and three injections from one hold is worse than one. If it is (1), the chord owner is not the backstop it looks like, which may matter to how much weight the I can settle it by running the DevTools event probe and the pty reader at the same time, so the keydown/keyup sequence and the emitted bytes line up on one timeline. I will do that and post it. Flagging it now rather than sitting on it, in case it changes anything you want in the branch. All of the above is pre-fix baseline on 1.4.163, so it stands on its own and does not need a branch build. Still happy to run the real-device pass once one exists. |
matchFileSearchShortcut runs ahead of the shortcut resolver and takes the physical-code fallback itself. 'Process' is not a Latin key, so shouldUseNonLatinShortcutPhysicalFallback allows the fallback and a composing Ctrl+Shift+F matched sidebar.search.toggle on its code before the guard was reached. Hoisting the guard above it closes that, and the pending-composition lookup it needs is already available there. Verified: with the guard at its previous position the new test sees onSearchSelectedText called once; hoisted, it is not called. matchSearchNavigate is unaffected -- it compares e.key directly, so 'Process' never matches. Also reads the pending composition back after Escape in the xterm cancel test instead of asserting on a captured reference, so it states the intent whether the cancel path clears the field in place or detaches the object. Both found by CodeRabbit on stablyai#12120.
|
Both applied — the first one was a real hole, and I verified it before taking it. Guard ordering. Confirmed by calling the matcher directly:
One correction: Worth noting for anyone reading across the stack: the guard's previous position is Stale pending reference. Fair, and applied. The cancel path does clear Focused suite is 160 passing across 7 files, typecheck clean. |
|
Settled the three-injections-per-hold question from my previous comment, and the answer is worse than either candidate I offered. The modified-enter chord lock is not a backstop at all — a re-render releases it, so one held Shift injects one newline per render. The device ruled out the first candidateI ran the DevTools event probe and the pty reader together on 1.4.163 so the key events and the emitted bytes share a timeline. Holding Shift for ~9 seconds mid-composition produced: So Windows does not deliver a held modifier as repeated down/up pairs. It is one keydown, a long auto-repeat run, and exactly one keyup at the end. That kills the candidate I thought most likely. The real amplifier is effect re-registration
Driving the handler with the captured event sequence, holding Shift across 50 auto-repeats: That matches what I see on the device. In a plain PowerShell pane, which emits almost nothing, I measured three injections per hold. In a Claude Code pane, which repaints continuously, holding Shift produces a continuous stream of newlines — the injection rate simply follows the render rate. Why this matters for the branchThe blast radius is not "one stray newline per shifted syllable". It is unbounded, and it scales with how busy the TUI is, which is exactly backwards from what a user would expect — the more the agent is streaming output, the faster the newlines arrive. It also means the chord owner is carrying none of the safety here, and the I have not tried to find which dependency in that effect's array changes per render, and it may not matter for this branch — the observable fact is that the lock does not survive a re-render, and the device confirms the consequence. Happy to dig into the dependency list separately if you think it is worth a follow-up. Regression case if you want it pinned, in the same style as the others: composition open, one |
A pty capture of one ~10s Ctrl hold mid-composition showed three \x1b[13;5u injections rather than the one the chord owner was expected to allow. Auto-repeat keydowns give exactly one send, so that was not the shape. Replaying the hold as repeated down/up pairs reproduces it: each release hands the chord back and the next press claims it again, so the injection count tracks the pair count one-for-one -- 3 pairs give 3, 5 pairs give 5 on main, and none here. That makes createTerminalImeModifiedEnterChordOwner a weaker backstop than it appears, and leaves the code gate carrying this case alone, which it does since ControlLeft is neither Enter nor NumpadEnter. Pty measurement by KimYounghwan8750 in stablyai#12120; the down/up-pair mechanism was his first candidate, confirmed here against the handler. Co-authored-by: KimYounghwan8750 <[email protected]>
|
Candidate 1 is it, and it reproduces against the handler. Replaying the hold as repeated down/up pairs rather than as auto-repeat keydowns: One-for-one with the pair count on The mechanism, from const releasedImeEnterModifier =
e.key === 'Shift' ? 'shift' : e.key === 'Control' ? 'ctrl' : null
if (releasedImeEnterModifier) {
heldImeEnterModifiers.delete(kind)
modifiedEnterChordOwner.release({ kind, code: e.code, timeStamp: e.timeStamp })
}The release is keyed on the logical key. The Two things follow. You do not need the combined DevTools+pty run to settle this particular Added as a regression test parameterised over 3 and 5 pairs, with a On the ordering inversion — |
…stration The previous commit pinned repeated down/up pairs as the amplifier. That was wrong. A device event probe shows Windows delivers a hold as one keydown, a long auto-repeat run, and exactly one keyup -- never as repeated pairs. The pair sequence does produce one injection each, but it is not a sequence the hardware emits, so the test was pinning a scenario that cannot occur. The real amplifier is effect re-registration: modifiedEnterChordOwner.clear() runs in the keyboard effect's cleanup, so every teardown/re-register drops the lock and the next auto-repeat keydown claims it again. Across 50 auto-repeats, main sends once with no re-render and 51 times with a re-render between each; this branch sends nothing either way. The injection rate follows the render rate, which makes the blast radius unbounded and worse in a busy TUI rather than better. Probe, pty capture and the corrected mechanism are all KimYounghwan8750's, in stablyai#12120; I had accepted the wrong candidate because the count happened to match. Co-authored-by: KimYounghwan8750 <[email protected]>
|
I was wrong about candidate 1, and your probe settles it. I matched on the count — 3 down/up pairs giving 3 sends lined up with the three you Reproduced your actual finding against the handler, holding Shift across 50 auto-repeats: Exactly your numbers. Zero on this branch either way. Replaced the regression test accordingly — the previous one pinned a sequence that cannot On the consequence, which I think is the most important thing either of us has posted here: Agreed that the chord owner is carrying none of the safety and the |
|
Disclosure on my previous comment, because one line in it rests on a non-default setting of mine and I would rather you heard it from me than found it later. My Claude Code runs with What that does and does not touch: Unaffected. The pty byte measurements were taken in a plain PowerShell pane with no Claude Code running at all — that is where That is the mechanism, and it holds independently of any renderer. Affected. Exactly one sentence: my description of a Claude Code pane producing "a continuous stream of newlines" while Shift is held. The injection rate follows the render rate, and the render rate depends on which renderer the TUI is using — so that observation was made under the alt-screen renderer, not the default one. Treat it as "this is what a busy pane does", not as a calibrated figure for stock Claude Code. I will re-run the hold with the flag unset and post both numbers so the comparison is on the record. If the default renderer produces a lower rate, the qualitative point still stands, only smaller; if it produces a similar one, then the renderer mode is not a factor and the note can be dropped. Nothing about the fix changes either way — the |
|
Withdrawing the caveat I just posted: the renderer flag was never actually in effect, so every measurement here was on the stock renderer. I had been invoking it as Confirmed rather than assumed, on this machine:
So the one line I flagged stands as originally written: holding Shift mid-composition in a Claude Code pane produces a continuous stream of newlines, on the default main-screen renderer, with no non-default settings involved. Nothing else in my earlier comments was affected either way, and the plain-PowerShell pty measurements never involved Claude Code to begin with. Apologies for the noise — I would rather have over-disclosed and retracted than left a hidden variable sitting under a measurement you were about to fold into the PR description. |
Adapted from #11616 commit 9f449d7 and #12120 commit 290f42a. Co-authored-by: holdn2 <[email protected]>
Adapted from #11616 commit 9f449d7 and #12120 commit 290f42a. Co-authored-by: holdn2 <[email protected]>
|
Root-caused the re-render amplifier, and I owe you a correction on how I phrased it, since you quoted it in the PR description. What I wrote: "a re-render re-runs the effect, which releases the chord lock." What is actually true: a re-render does not by itself re-run the effect — React only re-runs it when a dependency identity changes. Measured against the real hook, holding Shift across 50 auto-repeats during composition: The middle row is the one my earlier wording would have predicted wrong. So the claim holds for this codebase, but only because of a specific unmemoized value — not as a general property of re-renders, and anyone reading it as the latter would draw the wrong conclusion. The specific cause: Your instinct to look at that dependency array separately was right. I filed it as #12269 with the evidence and a suggested fix, rather than leaving it as an aside here — it also means seven None of this changes #12265 or this branch: both stop these events being read as Enter upstream of the claim, so the lock's weakness is latent again rather than reachable. Congratulations on the landing, and thanks for the care you took with attribution and with checking my claims before adopting them — the corrected mechanism only exists because you refused to take the first version on trust. |
Adapted from #11616 commit 9f449d7 and #12120 commit 290f42a. Co-authored-by: holdn2 <[email protected]>
|
Closing this — #12265 landed the overlap, and a combined branch has no reason to exist once That PR carries the same work with the same authorship: @kunsanglee's and @nwparker's One piece is not: the deferred-newline fallback re-arm from #11896. const fallbackTimer = window.setTimeout(finish, fallbackMs)with no pending-composition re-check, so a composition still open at 200 ms can be split. Thanks to everyone who worked on this — and particularly to @KimYoungHwan8750, whose pty Nothing here needs to be carried over. Closing. |
Adapted from stablyai#11616 commit 9f449d7 and stablyai#12120 commit 290f42a. Co-authored-by: holdn2 <[email protected]>
Fixes #11878.
Summary
On Windows 11 with the Microsoft Korean IME (2-set / 두벌식), Orca's terminal has two user-visible bugs:
This is an integration proposal, not new discovery. Fixes for both already exist across four open PRs — #11616, #11937, #11896, #11870 — but each one alone leaves the other symptom open. This branch takes the minimum hunks from all four, preserves the original authors on the commits, and adds regression tests built from real-device captures.
Maintainers may prefer to land the source PRs individually, and that is a perfectly good outcome. This exists to offer one review surface where both symptoms close together. Happy to close it on request.
The trigger is narrower than "Shift+jamo", and that matters for testing
Measured on real hardware by @KimYoungHwan8750 in #11878 (Windows 11 Pro 26200, Microsoft Korean IME 2-beolsik, Orca 1.4.163), the gate is
isWindows && hasPendingImeComposition && isTerminalImeProcessEnter(e), and the predicate is satisfied by the Shift keydown itself — Windows reports it askey: 'Process',keyCode: 229,shiftKey: true,code: 'ShiftLeft'. So what actually decides it is whether a composition is already open when Shift goes down:빼,까starting a word)갔,있)That last row is why this is pervasive rather than an edge case: Korean past tense is 았/었/였 — 했다, 갔다, 있다, 됐다, 왔다 — so a shifted batchim lands in a large share of ordinary sentences, and is mid-composition by construction.
The mechanism is not Shift-specific. Ctrl pressed mid-composition is reported as
Process/229 the same way,getTerminalImeModifiedEnterKindreturnsctrlfor it, and the pre-fix predicate reached the Ctrl+Enter branch. That branch emits\x1b[13;5uunconditionally with no non-Kitty fallback, so a TUI that has not negotiated the protocol discards it silently — an injection with nothing visible on screen, which is why it has gone unreported. Verified here: onmainthat case emits\x1b[13;5u; on this branch it emits nothing.It also means a fix verified only against
계획or a word-initial빼can pass while the real-world case still fails. The three states above are in this branch as regression tests for exactly that reason.The blast radius is not one newline per shifted syllable
A device event probe run alongside a pty reader (measurement) shows the modified-Enter chord lock is released by any React re-render —
modifiedEnterChordOwner.clear()runs in the keyboard effect's cleanup, so every teardown/re-register drops it and the next auto-repeat keydown claims it again. Holding a modifier therefore injects once per render, not once per press. Driving the handler with the captured sequence across 50 auto-repeats:On the device that is three injections per hold in a quiet PowerShell pane, and a continuous stream of newlines in a repainting Claude Code pane. The rate follows how busy the agent is — the more output it streams, the faster the unwanted newlines arrive, which is backwards from what a user would expect and is why the reports here range from "occasional" to "unusable".
It also means the chord owner contributes nothing to safety here and the
codegate is carrying all of it. That is sound for this PR — the gate sits upstream of the claim and stops these events from ever being read as Enter — but the layer beneath it is not a second line of defence, and should not be reasoned about as if it bounds anything.Why one PR rather than four merges
Two symptoms, six independent event paths. A fix on any one still leaves a reachable failure:
isTerminalImeProcessEnterProcess/229 — including Shift itself. Checking only modifiers made a Shift press look like a chord.Processhas no logical key, so matching fell back to the physical code and firedCtrl+K/Ctrl+Wmid-composition, here and in window-level handlers.finish()directly, skipping the pending-composition re-check, and dropped a newline into the middle of a preedit.CompositionHelpercompositionendwas discarded when the nextcompositionstartarrived, so the previous commit never flushed; and Escape left a stalefinalizerTimer.@KimYoungHwan8750 verified the keydown and keyup halves compose on real hardware, and that #11616 alone leaves the keyup path open.
Screenshots
No visual change. This is terminal input handling; no UI surface is touched.
Testing
pnpm lint— see note belowpnpm typecheck— exit 0pnpm test— see note belowpnpm build— exit 0Focused suite, rebased onto
c9a37f58d: 7 files, 162 passed, 0 failed.On the four IME files
mainhas 98 tests; this branch has 132. Every new case was confirmed failing before its fix and passing after — except the word-initial one, which passes on both by design, because it pins that the fix does not start suppressing legitimate input.Why
pnpm lintandpnpm testare unchecked — both fail identically on pristinemainI am not claiming these pass. They fail in my environment, and they fail the same way on a clean
maincheckout before any of my changes, so I could not use them as a signal.pnpm test— my machine OOMs on the default worker count, so I ran it as 8 shards with--maxWorkers=3: 42,058 passed / 297 failed across 73 files. I then replayed those 73 files on this branch and on pristinemainunder identical conditions. Both give exactly 296 failed / 1,426 passed / 66 skipped. The one file-level difference is a swap between two load-flaky files that pass individually. No file underterminal-pane/fails anywhere.pnpm lint—verify:skill-bundle-manifestreportsresources/skills/{current-manifest,snapshot-registry,release-mapping}.jsonstale. Reproduced on a pristinemainworktree, exit 1. Everything before it passes: oxlint native, oxlint type-aware, reliability gates, max-lines ratchet, bundled-skill-guides. This branch touches nothing underresources/orskills/.If CI is green on these, treat the above as a local artifact.
AI Review Report
Reviewed with Claude (Opus 5). Risks checked and findings:
Cross-platform. Deliberately split, and worth reviewer attention:
isWindowsat every call site.isTerminalImeProcessEnteris stricter now, but is only reached underisWindows && hasPendingImeComposition. The keyup evidence map is only written underisWindows, so on macOS/Linux it stays empty and the added reads are no-ops.deferredNewlineSender.defer()is not Windows-gated and the xterm patch is shared. This is intended: fix(ime): stop dropping and splitting composition commits in the terminal #11896's rationale is that multi-segment Japanese bunsetsu conversion stays legitimately pending past any fixed total-elapsed deadline, so the idle ceiling is measured from the lastcompositionupdate.terminal-ime-composition-route.test.tsand the xterm dedup suite (Japanese, Chinese, ibus Hangul cases) pass unchanged.No
metaKeyhardcoding, no new shortcut labels, no path handling.Resource lifecycle. The keyup evidence map is keyed by
e.codeand bounded at 8 entries per code, and is cleared on bothblurand effect cleanup. Auto-repeat keydowns deliberately do not stack an entry, since a repeat run ends in a single release. The re-armed fallback timer clears itself infinish(), which also removes the addedcompositionupdatelistener;maxIdleMs = Math.max(fallbackMs, …)keeps the ceiling finite, so a stuck composition cannot strand a keystroke.SSH / remote / local. No transport, PTY routing, or reconnect behavior is touched. #11896's transport-identity and uncaptured-session routing changes are deliberately excluded — only its fallback re-arm hunk is ported.
Performance. A couple of array operations per Enter keydown/keyup on Windows only. The fallback timer re-arms at most
maxIdleMs / fallbackMstimes per deferred newline instead of firing once, bounded at 10 by default and only while a composition is open.What review flagged, and what changed as a result.
e17d22cf, I reproduced the rapid-double-Enter hole against this branch before taking it: two keydowns overwrite the single evidence slot, the first release drops it, and the second release synthesizes the very\x1b\rthe guard exists to prevent. Fixed here with his commit, authorship preserved..patchintroduces 20 trailing-whitespace lines. Those are blank context lines inside the embedded unified diff, and the file is byte-identical to fix(terminal): preserve pending IME commit across composition restart #11870's artifact, so I left it rather than diverge from the original author's output.Security Audit
Low risk surface:
KeyboardEventfields and composition events. They are compared, never parsed, concatenated, or evaluated. The change narrows what is accepted as a modified Enter; it never widens what reaches the PTY.pnpm install --frozen-lockfileis clean.stopImmediatePropagation()on IME-consumed non-Enter chords during an active composition. xterm already ignoreskeyCode229 while composing, so no input is lost, and it cannot fire outside an active composition on Windows.No follow-up items.
Notes
Attribution. Original authorship is preserved with
--authoron the ported fixes, andCo-authored-by:where only part of a commit was taken or where the work came from a shared capture.Thank you to all four authors — this is their work, reassembled.
Known adjacent gap, not fixed here.
heldImeEnterModifiersis only cleared on a modifier keyup or onblur, never at a composition boundary. @mochizuki1105 reports the same visible symptom with a Japanese IME through that path, and their control experiments (Shift required, active composition required, Linux unaffected) point at it specifically. This branch does not close that, and I am not claiming it does.Out of scope, deliberately: Microsoft Pinyin Backspace/Delete and Shift mode-toggle (#11550), macOS Pinyin stale preedit (#11938), generalizing all IME-owned shortcuts beyond Enter (#11273), #11896's transport-routing changes, and UI or settings changes.
Verification status — what is measured, and what is not.
Marked ready for review to unblock CI and put it in front of reviewers. The gap below is unchanged; it is stated plainly here rather than left implicit behind draft status, and I am not asking for a merge ahead of it.
Beyond the unit suite, I built a standalone browser harness loading the real patched
@xterm/xtermfrom this branch plus the real production predicates, and typed into it with a real Microsoft Korean IME on Windows 11 build 26200 — genuine composition events rather than synthesized ones. It showed correct commit ordering with no stray\rduring Korean input. That covers commits 1, 2, 5, 6 and 7.It does not cover the keyup gate, which lives inside the
useTerminalKeyboardShortcutshook and needs the full pane-manager and transport surface; that remains unit-tested only. The harness also has no PTY, so the ConPTY round trip is unverified.Full in-app verification under Electron is still outstanding, and it is the one thing I would want before this merges. @KimYoungHwan8750 has a machine reproducing this daily and has offered byte-level confirmation of what actually reaches the pty from a raw-mode reader — that does not need a branch build, and it would establish the pre-fix baseline that everything here has so far inferred rather than measured. I will post those results as soon as they exist.
Reviewers on Windows with a Korean IME: independent confirmation is very welcome, as is a maintainer steer on whether you would rather take the source PRs separately.