Skip to content

feat(terminal): encode IME commits as CSI-u under the all-keys kitty flag - #13310

Merged
nwparker merged 18 commits into
mainfrom
nwparker/ime-kitty-flag8-commit
Aug 9, 2026
Merged

nwparker merged 18 commits into
mainfrom
nwparker/ime-kitty-flag8-commit

Conversation

@nwparker

@nwparker nwparker commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Fourth layer of the IME stack. Stacked on nwparker/ime-e2e-korean-headless (#13290) — review that first; this diff is only the top commit.

The hole

A pane that negotiates the kitty keyboard protocol's report_all_keys_as_escape_codes flag (bit 3, 0b1000) has asked for every printable key as a CSI-u escape code. Our commit path wrote IME-committed text raw, so that pane received a legacy byte stream it had explicitly declined.

This is not a CJK bug. The predicate that routes text through this path has no IME-specific condition — it is every printable key. So the misencoding hit every macOS user typing plain letters into a flag-8 pane, and CJK users only inherited it. What such an app loses: key-release events for printable keys, modifier disambiguation on printable keys, and associated-text reports.

The shape

claimKeyEvent is untouched — still unconditional, still structural, still no kitty read on the keydown hot path. The flag read moved into the commit path, where it happens once per commit rather than once per keystroke. A unit test pins exactly that: the flags getter is not called across a keydown and a keypress, and is called exactly once when the commit arrives.

The encoder is xterm's own KittyKeyboard, reused rather than hand-rolled.

The gate is bit 3 alone

Not "kitty is active", not flags !== 0. Previous attempts got this wrong in both directions — one had no gate, one gated on any negotiation, which strips the substitution from every pane that negotiates anything at all.

negotiated flags committed , from the Comma key why
0 , raw protocol inactive
1 disambiguate , raw does not change printable keys
2 event types , raw does not change printable keys
4 alternate keys , raw does not change printable keys
5, 7 , raw bit 3 clear
16 associated text , raw decorates a report bit 3 would already have produced; alone it produces none
8 CSI 44 u bit 3 set
9 CSI 44 u bit 3 set alongside others
15 CSI 44 u bit 3 set alongside others
24 (8+16) CSI 44 ; ; 44 u see the caveat below

Also pinned: a shifted substitution (?) encodes as CSI 63 ; 2 u, keeping the shift modifier; and a one-press/two-character commit (——) encodes as one report, CSI 95 ; 2 u, not one per character — bit 3 reports keys, and that was a single key.

The caveat, stated plainly

Under flag 8 without flag 16, the CSI-u report carries the physical key's codepoint, so the committed glyph is not delivered. A Korean user typing in such a pane would not get their syllable.

That is the reference design's deliberate reading, not an oversight: flag 8 is the application declaring it does not want text, and flag 16 (report_associated_text) is how it asks for text back. We are porting that reading rather than inventing a third behaviour.

Implementing flag 16 properly is not a small follow-up. The flags-24 row above is the evidence, and it is pinned by a test: the associated-text slot comes back as 44 — the physical , — where the committed , (U+FF0C, 65292) would need to be. Reading our encoder shows why. _buildCsiUSequence derives the associated text with textCode = ev.key.codePointAt(0) — the same ev.key it derives the keycode from. There is no way to hand it a committed glyph separately from the physical key: passing the glyph as ev.key fixes the text field but corrupts the keycode field, and multi-character commits fail the ev.key.length === 1 test outright and produce no report at all. Closing this requires changing the encoder to accept associated text as its own parameter — an upstream change or a local fork — not a wider gate here.

Scope boundary

Composing IMEs (Hangul, kana) are never claimed by this path — the composition path owns them — so their commits are not re-encoded here. Bit-3 fidelity for composition commits would be a separate change to the composition path. Pinned by test so the boundary is not mistaken for coverage.

The dashboard preview bridge installs the forwarder with no pane to negotiate with; it omits the getter and gets raw text. Also pinned.

Discrimination proof

Reverted the production edit (the sendInput call in forwardCommittedText), left the tests in place:

Tests  6 failed | 14 passed (20)

AssertionError: expected ',' to be '^[[44u'      // flags 8, 9, 15
AssertionError: expected ',' to be '^[[44;;44u'  // flags 24
AssertionError: expected '?' to be '^[[63;2u'    // shifted
AssertionError: expected '——' to be '^[[95;2u'    // multi-character

The 14 raw-behaviour cases still passed with the edit reverted — so the new tests discriminate the fix specifically, rather than being coupled to the presence of the edit.

Implementation note: how the encoder is reached

KittyKeyboard is not in @xterm/xterm's public typings — it lives in the package's shipped src/ tree. Reusing it therefore means a deep import into a pinned dependency. Verified working through all three toolchains: vitest, tsc --noEmit (the file's internal const enums do not trip isolatedModules), and a full electron-vite build.

Two honest costs, neither blocking:

  • Bundle duplication. The renderer chunk now contains two copies of the class — xterm's prebuilt lib bundle already had one. Measured: 2 occurrences of a distinctive key-table constant in terminal-shortcut-policy-*.js. A few KB of key tables.
  • Version coupling. A deep import could break on an xterm bump. In practice this version is already pinned by config/patches/@[email protected], which fails to apply across a bump — so a bump is already a controlled event that would surface this.

The alternative was hand-rolling CSI-u, which would have duplicated the encoding rules instead of the bytes and drifted from xterm's own keydown path.

One pinned behaviour worth flagging

The shifted case encodes with 63 (?), not the unshifted 47 (/) that a strict protocol reading would want as the base key. xterm's encoder only unwinds a shifted key to its base through Digit*/Key* codes, and this press carries Slash. This is the shared encoder's existing behaviour on every path, not something the commit path introduces. Pinned as-is with a comment rather than worked around.

Verification

  • npx vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/ src/renderer/src/lib/pane-manager/ — 313 files, 3906 passed, 1 skipped, 0 failed
  • rm -f config/*.tsbuildinfo && pnpm run typecheck — clean
  • npx oxlint <changed> — clean; npx oxfmt --check — clean on all changed files (17 pre-existing format issues elsewhere in the tree, all .md / tests/tools, untouched by this branch)
  • node config/scripts/check-reliability-gates.mjs — passed, 73 gates
  • node config/scripts/check-react-doctor-changed.mjs — 24 files scanned, 0 issues
  • pnpm run build:electron-vite — succeeds

Not done: no hardware validation in a live flag-8 pane. The evidence here is unit-level plus a clean production build.

Made with Orca 🐋

nwparker and others added 8 commits August 9, 2026 01:09
Typing 2-Set Korean shows committed syllables but not the in-progress jamo, so
the user composes each syllable blind. Long-standing hole in the vendored
terminal library, not a regression: the same test fails identically against the
bundle this branch starts from.

The `.active` class that CSS keys `display: block` off is added only in
`compositionstart` and dropped in `_finalizeComposition`. Some IMEs (observed on
Windows/WSL Korean) resume a composition with a bare `compositionupdate` and no
second `compositionstart`, by which point `compositionend` has already hidden the
overlay, so the resumed preedit is written into a hidden element and never
positioned. `updateCompositionElements` also early-returned on `!_isComposing`,
so it would not lay the overlay out either.

Re-show the overlay on an update that carries data, and key the layout guard on
the shown overlay instead. `_isComposing` is deliberately left alone, so no
commit bookkeeping changes and `onData` stays byte-identical. The two guards are
equivalent on every pre-existing path: `compositionstart` sets both,
`_finalizeComposition` clears both.

The bundle hunks are the same two edits applied to the shipped minified output;
the sourcemaps are carried through unchanged.
…ows capture

The synthetic test pins the shape; this replays events a real Microsoft Korean
IME emitted on Windows/WSL. The capture holds three compositionupdates that
resume a composition with no second compositionstart — the exact ordering that
wrote the preedit into a hidden overlay.

Without the fix all three report shown:false; with it all three are visible.
Fixture derived from the sealed 11919-windows-wsl-current capture, which is
read-only and unmodified.

Co-authored-by: Orca <[email protected]>
… artifact

The capture logs each event twice — a dispatch record and a batched next-frame
re-log. Deriving from both replayed every event twice, which made three
compositionupdates appear to land after a session had ended. Filtered to
dispatch records the capture holds zero resumes and 11 balanced sessions, so
the previous toHaveLength(3) was pinning an artifact of the derivation.

Re-scoped to what the capture does prove: the preedit stays visible across all
37 real updates. Verified by reverting the patch that this passes either way,
so it is coverage and the synthetic test remains the discriminator. Both facts
are now stated in the file.

Co-authored-by: Orca <[email protected]>
The previous commit accidentally reverted it: checking main's patch and lockfile
into the worktree to test whether a test discriminates also stages them, so the
commit that followed swept them up.

Co-authored-by: Orca <[email protected]>
…allowlist removal

The gate listed terminal-ime-input-source.test.ts, which went with the
input-source allowlist. Points at the substituted-text commit test instead,
which covers what the gate is actually protecting: text committed outside a
composition session reaching the pty exactly once.

Co-authored-by: Orca <[email protected]>
The predicate withholds a keydown's byte until the commit arrives, so a key the
IME eats without committing would be dropped. Measured across the recorded
corpus that case does not occur, and the browser marks IME-owned presses on the
keydown itself. Both facts belong next to the predicate rather than only in a
handoff note, since the obvious fix for the imagined gap is a timer, and a timer
here once wrote a newline the user never typed.

Co-authored-by: Orca <[email protected]>
Flag 8 asks for every printable key as an escape code; this path sends the
committed text raw instead. That is a deliberate trade, not an oversight, but it
was untested — the suite only covered the disambiguate flag. Pinning it makes
the choice visible and records the gate to use if it ever needs closing.

Co-authored-by: Orca <[email protected]>
@nwparker
nwparker force-pushed the nwparker/ime-e2e-korean-headless branch from d46e339 to fc54888 Compare August 9, 2026 08:18
@nwparker
nwparker force-pushed the nwparker/ime-kitty-flag8-commit branch from c414502 to 9b61584 Compare August 9, 2026 08:18
nwparker and others added 7 commits August 9, 2026 01:57
…ched the pty

Claiming the keyup unconditionally suppressed xterm's release report. That was
sized for the old design, which claimed only a short punctuation list; the
structural claim takes every printable keydown, so on macOS an app that
negotiated kitty report_event_types stopped seeing releases for ordinary typing
and would treat every printable key as held down.

Suppress the release only when the press put nothing on the wire — swallowed by
the input source, or owned by a composition transaction. xterm emits nothing
from keyup unless kitty report_event_types (or win32 input mode) is on, so
letting it through is inert everywhere else.

Co-authored-by: Orca <[email protected]>
…input

Both IME defects that shipped and were reverted walked through a suite of ~3000
passing assertions, because every one of them was about bytes reaching the PTY.
A preedit rendered into a hidden overlay satisfies all of them while the user
composes blind. The real-geometry coverage that would have caught it existed but
was headful, env-gated and macOS-only, so it never ran in CI.

Drives composition through CDP Input.imeSetComposition instead of a native input
source, which removes the accessibility grant and the system input source that
forced the headful gate. The suite runs in the normal headless project in about
55s serially, and asserts the composition overlay's real bounding rect — the one
property an overlay clipped to max-width:0 cannot fake and a DOM emulator cannot
produce.

Three tests are red on main and marked test.fail() so they stay visible in CI and
flip loud when their fix lands: the preedit resumed by a bare compositionupdate,
and full-width punctuation and digits committed from a keydown that still carries
the ASCII layout key.

Co-authored-by: Orca <[email protected]>
Validated on real macOS hardware: with the two fixes below this layer, all
three report "Expected to fail, but passed". Korean preedit renders at
non-zero geometry through every jamo, and an Apple pinyin source sends
ef bc 8c e3 80 82 to the pty where main sends ASCII.

Worth recording why the punctuation case looked green on main once: an input
source whose id happens to contain an allowlist term, as Sogou's does, satisfies
the old gate. Correctness there depended on which IME the user had selected.

Co-authored-by: Orca <[email protected]>
The ten headless IME specs on this branch all decided ownership through a macOS
user-agent override, so the two platforms whose failure mode is a *dropped*
character rather than a downgraded one had no coverage at all, and the one
Windows-recorded trace already in the suite was replayed under whichever policy
the runner happened to report — macOS locally, Linux on the CI shards.

Adds four Linux specs and two Windows specs, every one of them replaying a
native capture rather than a hand-authored ordering:

- IBus/X11 Hangul mixed with literal ASCII. Its `compositionend` is EMPTY and
  the syllable arrives afterwards as a bare `insertText`, so reading the commit
  off `compositionend.data` — which the Windows capture rewards — drops every
  syllable on this framework.
- fcitx5/Wayland Hangul. No keydown at all for a composing key, not even 229,
  and physically wrong `code` values on the literal keys. Any ownership rule
  reading 229 or `code` fails here.
- Numeric pinyin candidate selection under both frameworks, with the ordinary
  digit kept as the negative control, so the two directions are pinned against
  each other rather than separately.
- Windows Microsoft Korean captured with real scan codes, including the two
  lines committed with Shift held.

Each asserts both sides of the boundary: the preedit's real geometry at every
frame the user would see, and the exact byte stream the native run put on the
PTY. The recorded `onData` the Windows/WSL fixture already carried is now
asserted instead of sitting unused.

Chinese moves up to first-class alongside Korean: pinyin preedit width is now
pinned the way the Japanese phrase already was, and full-width punctuation is
covered in the composition-session shape the Windows and Linux frameworks use,
not only the macOS insertText shape.

Two harness fixes fell out of the recorded traces and are why the IBus one
passes. The replay applied each event's recorded textarea state *after*
dispatch, one event too late for the handlers that read `textarea.value`; and
it left a task boundary between `compositionend` and the `input` carrying the
commit, which Chromium never inserts, letting xterm's deferred finalizer settle
against a textarea the committed text had not reached yet.

Co-authored-by: Orca <[email protected]>
…esising them

The macOS coverage on this branch drives Chromium composition through CDP, which
is genuine but hand-ordered, so it could not assert the one property that
decides the macOS rule: a composing keydown arrives with keyCode 229 while `key`
is still the single translated character the input source produced — `ㅎ`, not
`Process` — which is indistinguishable by length from an ordinary printable key.
Three native captures were sitting unused in the evidence set.

Adds a recorded 2-Set Korean session, including the syllable boundary where one
composition closes and the next opens with no keydown between them, asserted
against its own recorded byte stream.

Adds the third failure mode, which had no coverage in any shape: an abandoned
preedit leaking to the shell. Pinyin and Cangjie both backspace a composition
away to nothing, and the assertion is not "the right bytes" but "no bytes".

Both cancellation captures continue with a literal `ordinary` typed as bare
keydowns, the recorder's own negative control. That tail carries no `input`
events because the build it was captured on produced the byte from the keydown
itself, so replaying it would measure the recorder rather than the product; the
specs cut at the `compositionend` and say so.

Co-authored-by: Orca <[email protected]>
… the suite

Qingg matches none of the terms the pre-structural build enumerated, so on that
build its bypass never installs. It is the one arm no headless spec can express,
and the only test here that the pre-structural build cannot pass.

Promoted from scratch with four changes, each forced by a measurement rather than
by taste:

- A non-attached input method is a refusal, not a negative result. macOS attaches
  per app instance and the attach can simply fail — 3 of 6 instances under
  exclusive host access, and re-selecting the source did not recover one of them
  across 9 keystrokes. That is now `test.skip()` with a reason naming the rerun,
  not a thrown error, and the suite does not gate on a fully green session.
- Attachment is probed with a LETTER. Punctuation substitution emits no
  compositionstart and no keyCode 229 even under a fully attached source, so at
  the keydown it is indistinguishable from having no source at all. The
  punctuation arms are judged on PTY bytes alone.
- The ASCII-layout control is now part of the spec rather than a side experiment.
  Without it a build that rewrote every `.` into `。` unconditionally would pass
  the Qingg arm and be badly wrong.
- The assertion runs by default instead of behind a strict-mode flag, and gained
  a non-vacuity check: the input source must have committed something. That is
  the sharp end of the mechanism — on the old build the DOM carries only keydown
  and keyup, so nothing is committed at all and the character is destroyed before
  the source is asked.

The verdict stays an equality between two measurements, never a comparison
against a hardcoded glyph, so it holds whatever punctuation mode the operator's
input source happens to be in. It reads `beforeinput`, not `input`: the forwarder
consumes `input` in the capture phase on the pane element, so a probe on the
helper textarea never sees it and a strict run fails with correct bytes
underneath.

Co-authored-by: Orca <[email protected]>
…flag

A pane that negotiates `report_all_keys_as_escape_codes` (bit 3) asked for every
printable key as a CSI-u report. The commit path wrote IME-committed text raw,
so such a pane got a legacy byte stream it had declined. That predicate has no
IME-specific condition, so it affected every macOS user in such a pane, not just
CJK users.

Encode the press that produced the commit instead, reusing xterm's own kitty
encoder rather than hand-rolling CSI-u.

`claimKeyEvent` is untouched: still unconditional, still structural, still no
kitty read on the keydown. The flag read happens once per commit.

The gate is bit 3 alone. Flags 1/2/4/16 leave printable keys as text, so panes
negotiating only those keep receiving substituted characters; gating on "kitty
active" would strip the substitution from every pane that negotiates anything.

Known limit, pinned by test: the report carries the physical key's codepoint,
not the committed glyph. Bit 3 is the app declaring it does not want text, and
bit 4 is how it asks for text back — but xterm's encoder derives that text field
from the same `key` it derives the keycode from, so carrying the committed glyph
needs an encoder change, not a wider gate.
@nwparker
nwparker force-pushed the nwparker/ime-e2e-korean-headless branch from fc54888 to 3f43064 Compare August 9, 2026 09:00
@nwparker
nwparker force-pushed the nwparker/ime-kitty-flag8-commit branch from 9b61584 to 326d070 Compare August 9, 2026 09:00
nwparker and others added 2 commits August 9, 2026 02:12
…flags

The commit encoder never passed an event type, so xterm's encoder applied its
PRESS default to every auto-repeat keydown. A pane negotiating report_event_types
alongside bit 3 saw one held key as N separate strikes.

Carry the keydown's `repeat` on the claimed press and map it to the protocol's
REPEAT. The event type only reaches the wire when report_event_types is
negotiated, so this is inert for panes that asked only for bit 3.

Co-authored-by: Orca <[email protected]>
@nwparker
nwparker marked this pull request as ready for review August 9, 2026 22:39
@nwparker
nwparker changed the base branch from nwparker/ime-e2e-korean-headless to main August 9, 2026 22:39
@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 261f1c8d-ffa8-4c86-9fe0-1559f5b48511

📥 Commits

Reviewing files that changed from the base of the PR and between 01bcc8d and b827aeb.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • config/patches/@[email protected]
  • config/reliability-gates.jsonc
  • src/renderer/src/components/dashboard-popout/AgentTerminalPreview.test.tsx
  • src/renderer/src/components/dashboard-popout/preview-terminal-ime-bridge.ts
  • src/renderer/src/components/terminal-pane/__fixtures__/windows-wsl-hangul-resumed-preedit-trace.json
  • src/renderer/src/components/terminal-pane/terminal-ime-input-source.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-input-source.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-kitty-commit-encoding.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-candidates.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-substituted-text-commit.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-won-composition-order.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-xterm-resumed-preedit-visibility.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-xterm-windows-resumed-preedit-trace.test.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.ts
  • src/renderer/src/components/terminal-pane/xterm-bypass-policy.test.ts
  • src/renderer/src/components/terminal-pane/xterm-bypass-policy.ts
💤 Files with no reviewable changes (4)
  • src/renderer/src/components/terminal-pane/terminal-ime-input-source.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-candidates.ts
  • src/renderer/src/components/terminal-pane/xterm-bypass-policy.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-input-source.ts

📝 Walkthrough

Walkthrough

The change removes macOS input-source detection and bypass handling from terminal IME setup. Native-text forwarding now claims eligible printable keydowns structurally and tracks PTY output. IME commits can use Kitty keyboard reports when negotiated. Tests cover substituted text, composition ownership, Kitty flags, Backslash handling, and resumed Windows/WSL Korean preedits. Reliability gates now run the substituted-text commit test.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides extensive scope and testing details but omits the required Summary, Screenshots, AI Review Report, Security Audit, and Notes sections. Add all template headings and complete the missing Screenshots, AI Review Report, Security Audit, and Notes content, including explicit cross-platform review confirmation.
Docstring Coverage ⚠️ Warning Docstring coverage is 23.81% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: encoding IME commits as CSI-u when the Kitty all-keys flag is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.ts (1)

142-186: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

A commit that arrives after its keyup loses the kitty encoding. The keyup branch clears claimedPress while pendingForward stays armed, so encodeImeCommitAsKittyReport receives null and the commit falls back to raw text. The test suite documents the keyup-before-commit ordering but never exercises it under kitty flag 8, so the gap is not caught.

  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.ts#L142-L186: retain the claimed press when the keyup fires while pendingForward is still true, and consume it in forwardCommittedText before clearing it.
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.test.ts#L275-L293: add a case that installs with flag 8, claims a keydown, dispatches the keyup, then dispatches the insertText, and asserts the commit is a CSI-u report rather than raw text.
🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/terminal-ime-xterm-windows-resumed-preedit-trace.test.ts (1)

67-70: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Dispose the terminal in afterEach and drain the pending composition timer.

Line 112 disposes inside the test body. If an assertion before it fails, disposal never runs. The sibling file terminal-ime-xterm-resumed-preedit-visibility.test.ts at lines 172-178 drains two event-loop turns before dispose, because updateCompositionElements re-arms on a timer. Apply the same teardown here so a pending callback does not run against a live-but-abandoned terminal.

♻️ Proposed teardown change
+const openTerminals: Terminal[] = []
+
 function nextEventLoop(): Promise<void> {
   return new Promise((resolve) => window.setTimeout(resolve, 0))
 }
-  afterEach(() => {
+  afterEach(async () => {
+    // updateCompositionElements re-arms on a timer; let the pending one run before dispose.
+    await nextEventLoop()
+    await nextEventLoop()
+    while (openTerminals.length > 0) {
+      openTerminals.pop()?.dispose()
+    }
     vi.restoreAllMocks()
     document.body.replaceChildren()
   })
     const terminal = new Terminal()
     terminal.open(container)
+    openTerminals.push(terminal)
     const textarea = terminal.textarea
     }
-    terminal.dispose()
 
     // Guards against a fixture that silently stops covering anything.

Also applies to: 112-112


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 261f1c8d-ffa8-4c86-9fe0-1559f5b48511

📥 Commits

Reviewing files that changed from the base of the PR and between 01bcc8d and b827aeb.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • config/patches/@[email protected]
  • config/reliability-gates.jsonc
  • src/renderer/src/components/dashboard-popout/AgentTerminalPreview.test.tsx
  • src/renderer/src/components/dashboard-popout/preview-terminal-ime-bridge.ts
  • src/renderer/src/components/terminal-pane/__fixtures__/windows-wsl-hangul-resumed-preedit-trace.json
  • src/renderer/src/components/terminal-pane/terminal-ime-input-source.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-input-source.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-kitty-commit-encoding.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-candidates.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-substituted-text-commit.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-won-composition-order.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-xterm-resumed-preedit-visibility.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-xterm-windows-resumed-preedit-trace.test.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.ts
  • src/renderer/src/components/terminal-pane/xterm-bypass-policy.test.ts
  • src/renderer/src/components/terminal-pane/xterm-bypass-policy.ts
💤 Files with no reviewable changes (4)
  • src/renderer/src/components/terminal-pane/terminal-ime-input-source.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-candidates.ts
  • src/renderer/src/components/terminal-pane/xterm-bypass-policy.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-input-source.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.ts (1)

142-186: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

A commit that arrives after its keyup loses the kitty encoding. The keyup branch clears claimedPress while pendingForward stays armed, so encodeImeCommitAsKittyReport receives null and the commit falls back to raw text. The test suite documents the keyup-before-commit ordering but never exercises it under kitty flag 8, so the gap is not caught.

  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.ts#L142-L186: retain the claimed press when the keyup fires while pendingForward is still true, and consume it in forwardCommittedText before clearing it.
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.test.ts#L275-L293: add a case that installs with flag 8, claims a keydown, dispatches the keyup, then dispatches the insertText, and asserts the commit is a CSI-u report rather than raw text.
🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/terminal-ime-xterm-windows-resumed-preedit-trace.test.ts (1)

67-70: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Dispose the terminal in afterEach and drain the pending composition timer.

Line 112 disposes inside the test body. If an assertion before it fails, disposal never runs. The sibling file terminal-ime-xterm-resumed-preedit-visibility.test.ts at lines 172-178 drains two event-loop turns before dispose, because updateCompositionElements re-arms on a timer. Apply the same teardown here so a pending callback does not run against a live-but-abandoned terminal.

♻️ Proposed teardown change
+const openTerminals: Terminal[] = []
+
 function nextEventLoop(): Promise<void> {
   return new Promise((resolve) => window.setTimeout(resolve, 0))
 }
-  afterEach(() => {
+  afterEach(async () => {
+    // updateCompositionElements re-arms on a timer; let the pending one run before dispose.
+    await nextEventLoop()
+    await nextEventLoop()
+    while (openTerminals.length > 0) {
+      openTerminals.pop()?.dispose()
+    }
     vi.restoreAllMocks()
     document.body.replaceChildren()
   })
     const terminal = new Terminal()
     terminal.open(container)
+    openTerminals.push(terminal)
     const textarea = terminal.textarea
     }
-    terminal.dispose()
 
     // Guards against a fixture that silently stops covering anything.

Also applies to: 112-112


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 261f1c8d-ffa8-4c86-9fe0-1559f5b48511

📥 Commits

Reviewing files that changed from the base of the PR and between 01bcc8d and b827aeb.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • config/patches/@[email protected]
  • config/reliability-gates.jsonc
  • src/renderer/src/components/dashboard-popout/AgentTerminalPreview.test.tsx
  • src/renderer/src/components/dashboard-popout/preview-terminal-ime-bridge.ts
  • src/renderer/src/components/terminal-pane/__fixtures__/windows-wsl-hangul-resumed-preedit-trace.json
  • src/renderer/src/components/terminal-pane/terminal-ime-input-source.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-input-source.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-kitty-commit-encoding.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-candidates.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-substituted-text-commit.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-won-composition-order.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-xterm-resumed-preedit-visibility.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-xterm-windows-resumed-preedit-trace.test.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.ts
  • src/renderer/src/components/terminal-pane/xterm-bypass-policy.test.ts
  • src/renderer/src/components/terminal-pane/xterm-bypass-policy.ts
💤 Files with no reviewable changes (4)
  • src/renderer/src/components/terminal-pane/terminal-ime-input-source.test.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-native-text-candidates.ts
  • src/renderer/src/components/terminal-pane/xterm-bypass-policy.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-input-source.ts
🛑 Comments failed to post (2)
config/reliability-gates.jsonc (1)

6685-6688: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

A blanket filename replacement reached fields that require different handling. Renaming terminal-ime-input-source.test.ts to terminal-ime-substituted-text-commit.test.ts was applied to every occurrence. Two fields are not simple path references: one carries assertion text that must describe the new file, and one is a dated record of a command that already ran.

  • config/reliability-gates.jsonc#L6685-L6688: rewrite the assertions strings to describe what the new test file asserts, namely substituted text reaching the terminal and kitty flag 8 CSI-u encoding.
  • config/reliability-gates.jsonc#L6773-L6773: restore the original command in the 2026-07-07 evidenceRuns entry, and add a new dated entry if this cohort needs current evidence.
📍 Affects 1 file
  • config/reliability-gates.jsonc#L6685-L6688 (this comment)
  • config/reliability-gates.jsonc#L6773-L6773
src/renderer/src/components/terminal-pane/xterm-bypass-policy.test.ts (1)

123-126: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the contradictory comment.

Line 126 states the physical key "is no longer named anywhere in this file". Line 122 names Backslash in the test title and line 130 passes code: 'Backslash'. State that the policy no longer branches on the key instead.

📝 Proposed comment fix
     // Why: this policy carried a `code === 'Backslash'` bypass because the old
     // forwarder only claimed keys for input sources on a hardcoded allowlist.
-    // The structural claim covers every printable key, so the exception is gone
-    // and the physical key is no longer named anywhere in this file.
+    // The structural claim covers every printable key, so the policy no longer
+    // branches on this physical key.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

    // Why: this policy carried a `code === 'Backslash'` bypass because the old
    // forwarder only claimed keys for input sources on a hardcoded allowlist.
    // The structural claim covers every printable key, so the policy no longer
    // branches on this physical key.

@nwparker
nwparker merged commit 94cc867 into main Aug 9, 2026
82 of 88 checks passed
kunsanglee added a commit to kunsanglee/orca that referenced this pull request Aug 11, 2026
main replaced the design this branch was written against, so the conflict could
not be resolved by picking a side.

What changed underneath. The branch was based on eea0bb6, before stablyai#13128 gave
terminal composition ownership to xterm and before stablyai#13282 reverted it. Since
then stablyai#13288 made the native-text claim structural (every single printable
keydown, `key` read for length only) and stablyai#13310 encodes commits as CSI-u under
the kitty all-keys flag. terminal-ime-native-text-candidates.ts and the
getInputSourceFeatures argument the branch built on no longer exist.

Resolution, three judgments.

1. The forwarder takes main's version wholesale. The branch's punctuation
   feature-list claim is gone from main and reviving it would undo stablyai#13288.

2. The defect the branch reported is still in main, so it is reapplied on the
   new shape. claimKeyEvent bails on a chorded or composing event BEFORE the
   keyup branch that retires the claim, and every keyup inside a composition
   reports isComposing. The release is the only event that retires a claim, so
   the claim survives the composition; nothing else clears it until the next
   non-composing printable keydown or a blur. While it is stranded a keypress
   whose own keydown was refused (composition still live at keydown, ended by
   keypress) is bypassed with nothing armed to forward it, and the character is
   dropped. Fix: retire on a matching keyup first, then fold the chord and
   composition test into the return value.

   Every existing return value is preserved. Only the leaked state changes:
   a chorded or composing release returned false before and returns false now.

3. terminal-ime-native-text-claim-release.test.ts is rewritten against main's
   API. Its old body imported terminal-ime-native-text-candidates, which main
   deleted, so it could not compile. The two cases it now pins are the two the
   fix repairs; both fail against main's forwarder and pass against this one
   (verified by swapping the file back and rerunning).

Verified: terminal-ime-native-text-forwarder.test.ts 32/32 (main's own, all
still pass), the rewritten suite 2/2, use-terminal-pane-lifecycle 29/29,
dashboard-popout 220/220. tsconfig.node, tsconfig.tc.cli, tsconfig.tc.web all
0 errors. oxlint clean. max-lines ratchet OK.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…flag (stablyai#13310)

* fix(terminal): show a preedit the IME resumes without a compositionstart

Typing 2-Set Korean shows committed syllables but not the in-progress jamo, so
the user composes each syllable blind. Long-standing hole in the vendored
terminal library, not a regression: the same test fails identically against the
bundle this branch starts from.

The `.active` class that CSS keys `display: block` off is added only in
`compositionstart` and dropped in `_finalizeComposition`. Some IMEs (observed on
Windows/WSL Korean) resume a composition with a bare `compositionupdate` and no
second `compositionstart`, by which point `compositionend` has already hidden the
overlay, so the resumed preedit is written into a hidden element and never
positioned. `updateCompositionElements` also early-returned on `!_isComposing`,
so it would not lay the overlay out either.

Re-show the overlay on an update that carries data, and key the layout guard on
the shown overlay instead. `_isComposing` is deliberately left alone, so no
commit bookkeeping changes and `onData` stays byte-identical. The two guards are
equivalent on every pre-existing path: `compositionstart` sets both,
`_finalizeComposition` clears both.

The bundle hunks are the same two edits applied to the shipped minified output;
the sourcemaps are carried through unchanged.

* test(terminal): prove the resumed-preedit fix against a recorded Windows capture

The synthetic test pins the shape; this replays events a real Microsoft Korean
IME emitted on Windows/WSL. The capture holds three compositionupdates that
resume a composition with no second compositionstart — the exact ordering that
wrote the preedit into a hidden overlay.

Without the fix all three report shown:false; with it all three are visible.
Fixture derived from the sealed 11919-windows-wsl-current capture, which is
read-only and unmodified.

Co-authored-by: Orca <[email protected]>

* test(terminal): stop the recorded Hangul fixture pinning a derivation artifact

The capture logs each event twice — a dispatch record and a batched next-frame
re-log. Deriving from both replayed every event twice, which made three
compositionupdates appear to land after a session had ended. Filtered to
dispatch records the capture holds zero resumes and 11 balanced sessions, so
the previous toHaveLength(3) was pinning an artifact of the derivation.

Re-scoped to what the capture does prove: the preedit stays visible across all
37 real updates. Verified by reverting the patch that this passes either way,
so it is coverage and the synthetic test remains the discriminator. Both facts
are now stated in the file.

Co-authored-by: Orca <[email protected]>

* fix(terminal): restore the preedit visibility patch onto its own branch

The previous commit accidentally reverted it: checking main's patch and lockfile
into the worktree to test whether a test discriminates also stages them, so the
commit that followed swept them up.

Co-authored-by: Orca <[email protected]>

* fix(terminal): claim printable keydowns structurally so committed text survives

Co-authored-by: Orca <[email protected]>

* chore(reliability-gates): retarget the IME forwarding gate after the allowlist removal

The gate listed terminal-ime-input-source.test.ts, which went with the
input-source allowlist. Points at the substituted-text commit test instead,
which covers what the gate is actually protecting: text committed outside a
composition session reaching the pty exactly once.

Co-authored-by: Orca <[email protected]>

* docs(terminal): record why withholding a claimed keydown needs no timer

The predicate withholds a keydown's byte until the commit arrives, so a key the
IME eats without committing would be dropped. Measured across the recorded
corpus that case does not occur, and the browser marks IME-owned presses on the
keydown itself. Both facts belong next to the predicate rather than only in a
handoff note, since the obvious fix for the imagined gap is a timer, and a timer
here once wrote a newline the user never typed.

Co-authored-by: Orca <[email protected]>

* test(terminal): pin the kitty all-keys-as-escape-codes hole explicitly

Flag 8 asks for every printable key as an escape code; this path sends the
committed text raw instead. That is a deliberate trade, not an oversight, but it
was untested — the suite only covered the disambiguate flag. Pinning it makes
the choice visible and records the gate to use if it ever needs closing.

Co-authored-by: Orca <[email protected]>

* fix(terminal): keep the kitty key-release report for presses that reached the pty

Claiming the keyup unconditionally suppressed xterm's release report. That was
sized for the old design, which claimed only a short punctuation list; the
structural claim takes every printable keydown, so on macOS an app that
negotiated kitty report_event_types stopped seeing releases for ordinary typing
and would treat every printable key as held down.

Suppress the release only when the press put nothing on the wire — swallowed by
the input source, or owned by a composition transaction. xterm emits nothing
from keyup unless kitty report_event_types (or win32 input mode) is on, so
letting it through is inert everywhere else.

Co-authored-by: Orca <[email protected]>

* test(e2e): assert IME preedit geometry headlessly for Korean and CJK input

Both IME defects that shipped and were reverted walked through a suite of ~3000
passing assertions, because every one of them was about bytes reaching the PTY.
A preedit rendered into a hidden overlay satisfies all of them while the user
composes blind. The real-geometry coverage that would have caught it existed but
was headful, env-gated and macOS-only, so it never ran in CI.

Drives composition through CDP Input.imeSetComposition instead of a native input
source, which removes the accessibility grant and the system input source that
forced the headful gate. The suite runs in the normal headless project in about
55s serially, and asserts the composition overlay's real bounding rect — the one
property an overlay clipped to max-width:0 cannot fake and a DOM emulator cannot
produce.

Three tests are red on main and marked test.fail() so they stay visible in CI and
flip loud when their fix lands: the preedit resumed by a bare compositionupdate,
and full-width punctuation and digits committed from a keydown that still carries
the ASCII layout key.

Co-authored-by: Orca <[email protected]>

* test(e2e): drop the known-broken markers now the stack closes all three

Validated on real macOS hardware: with the two fixes below this layer, all
three report "Expected to fail, but passed". Korean preedit renders at
non-zero geometry through every jamo, and an Apple pinyin source sends
ef bc 8c e3 80 82 to the pty where main sends ASCII.

Worth recording why the punctuation case looked green on main once: an input
source whose id happens to contain an allowlist term, as Sogou's does, satisfies
the old gate. Correctness there depended on which IME the user had selected.

Co-authored-by: Orca <[email protected]>

* test(e2e): cover the Linux and Windows IME ownership shapes headlessly

The ten headless IME specs on this branch all decided ownership through a macOS
user-agent override, so the two platforms whose failure mode is a *dropped*
character rather than a downgraded one had no coverage at all, and the one
Windows-recorded trace already in the suite was replayed under whichever policy
the runner happened to report — macOS locally, Linux on the CI shards.

Adds four Linux specs and two Windows specs, every one of them replaying a
native capture rather than a hand-authored ordering:

- IBus/X11 Hangul mixed with literal ASCII. Its `compositionend` is EMPTY and
  the syllable arrives afterwards as a bare `insertText`, so reading the commit
  off `compositionend.data` — which the Windows capture rewards — drops every
  syllable on this framework.
- fcitx5/Wayland Hangul. No keydown at all for a composing key, not even 229,
  and physically wrong `code` values on the literal keys. Any ownership rule
  reading 229 or `code` fails here.
- Numeric pinyin candidate selection under both frameworks, with the ordinary
  digit kept as the negative control, so the two directions are pinned against
  each other rather than separately.
- Windows Microsoft Korean captured with real scan codes, including the two
  lines committed with Shift held.

Each asserts both sides of the boundary: the preedit's real geometry at every
frame the user would see, and the exact byte stream the native run put on the
PTY. The recorded `onData` the Windows/WSL fixture already carried is now
asserted instead of sitting unused.

Chinese moves up to first-class alongside Korean: pinyin preedit width is now
pinned the way the Japanese phrase already was, and full-width punctuation is
covered in the composition-session shape the Windows and Linux frameworks use,
not only the macOS insertText shape.

Two harness fixes fell out of the recorded traces and are why the IBus one
passes. The replay applied each event's recorded textarea state *after*
dispatch, one event too late for the handlers that read `textarea.value`; and
it left a task boundary between `compositionend` and the `input` carrying the
commit, which Chromium never inserts, letting xterm's deferred finalizer settle
against a textarea the committed text had not reached yet.

Co-authored-by: Orca <[email protected]>

* test(e2e): replay the recorded macOS IME shapes instead of only synthesising them

The macOS coverage on this branch drives Chromium composition through CDP, which
is genuine but hand-ordered, so it could not assert the one property that
decides the macOS rule: a composing keydown arrives with keyCode 229 while `key`
is still the single translated character the input source produced — `ㅎ`, not
`Process` — which is indistinguishable by length from an ordinary printable key.
Three native captures were sitting unused in the evidence set.

Adds a recorded 2-Set Korean session, including the syllable boundary where one
composition closes and the next opens with no keydown between them, asserted
against its own recorded byte stream.

Adds the third failure mode, which had no coverage in any shape: an abandoned
preedit leaking to the shell. Pinyin and Cangjie both backspace a composition
away to nothing, and the assertion is not "the right bytes" but "no bytes".

Both cancellation captures continue with a literal `ordinary` typed as bare
keydowns, the recorder's own negative control. That tail carries no `input`
events because the build it was captured on produced the byte from the keydown
itself, so replaying it would measure the recorder rather than the product; the
specs cut at the `compositionend` and say so.

Co-authored-by: Orca <[email protected]>

* test(e2e): promote the non-allowlist input-source punctuation spec to the suite

Qingg matches none of the terms the pre-structural build enumerated, so on that
build its bypass never installs. It is the one arm no headless spec can express,
and the only test here that the pre-structural build cannot pass.

Promoted from scratch with four changes, each forced by a measurement rather than
by taste:

- A non-attached input method is a refusal, not a negative result. macOS attaches
  per app instance and the attach can simply fail — 3 of 6 instances under
  exclusive host access, and re-selecting the source did not recover one of them
  across 9 keystrokes. That is now `test.skip()` with a reason naming the rerun,
  not a thrown error, and the suite does not gate on a fully green session.
- Attachment is probed with a LETTER. Punctuation substitution emits no
  compositionstart and no keyCode 229 even under a fully attached source, so at
  the keydown it is indistinguishable from having no source at all. The
  punctuation arms are judged on PTY bytes alone.
- The ASCII-layout control is now part of the spec rather than a side experiment.
  Without it a build that rewrote every `.` into `。` unconditionally would pass
  the Qingg arm and be badly wrong.
- The assertion runs by default instead of behind a strict-mode flag, and gained
  a non-vacuity check: the input source must have committed something. That is
  the sharp end of the mechanism — on the old build the DOM carries only keydown
  and keyup, so nothing is committed at all and the character is destroyed before
  the source is asked.

The verdict stays an equality between two measurements, never a comparison
against a hardcoded glyph, so it holds whatever punctuation mode the operator's
input source happens to be in. It reads `beforeinput`, not `input`: the forwarder
consumes `input` in the capture phase on the pane element, so a probe on the
helper textarea never sees it and a strict run fails with correct bytes
underneath.

Co-authored-by: Orca <[email protected]>

* feat(terminal): encode IME commits as CSI-u under the all-keys kitty flag

A pane that negotiates `report_all_keys_as_escape_codes` (bit 3) asked for every
printable key as a CSI-u report. The commit path wrote IME-committed text raw,
so such a pane got a legacy byte stream it had declined. That predicate has no
IME-specific condition, so it affected every macOS user in such a pane, not just
CJK users.

Encode the press that produced the commit instead, reusing xterm's own kitty
encoder rather than hand-rolling CSI-u.

`claimKeyEvent` is untouched: still unconditional, still structural, still no
kitty read on the keydown. The flag read happens once per commit.

The gate is bit 3 alone. Flags 1/2/4/16 leave printable keys as text, so panes
negotiating only those keep receiving substituted characters; gating on "kitty
active" would strip the substitution from every pane that negotiates anything.

Known limit, pinned by test: the report carries the physical key's codepoint,
not the committed glyph. Bit 3 is the app declaring it does not want text, and
bit 4 is how it asks for text back — but xterm's encoder derives that text field
from the same `key` it derives the keycode from, so carrying the committed glyph
needs an encoder change, not a wider gate.

* fix(terminal): report a held key's repeats as REPEAT under the kitty flags

The commit encoder never passed an event type, so xterm's encoder applied its
PRESS default to every auto-repeat keydown. A pane negotiating report_event_types
alongside bit 3 saw one held key as N separate strikes.

Carry the keydown's `repeat` on the claimed press and map it to the protocol's
REPEAT. The event type only reaches the wire when report_event_types is
negotiated, so this is inert for panes that asked only for bit 3.

Co-authored-by: Orca <[email protected]>

* chore: drop non-mergeable IME e2e scratch files

---------

Co-authored-by: Orca <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant