Skip to content

fix(terminal): preserve Polish and Option-composed text in kitty panes - #21082

Merged
nwparker merged 2 commits into
mainfrom
nwparker/polish-stuff
Sep 20, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/polish-stuff

Conversation

@nwparker

@nwparker nwparker commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​191 $\color{#cf222e}{\Huge{\mathbf{−}}}$​45 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​146
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​21 $\color{#cf222e}{\Huge{\mathbf{−}}}$​76 $\color{#cf222e}{\Huge{\mathbf{−}}}$​55

ELI5

With Option configured to compose characters, starting a kitty-protocol TUI could turn Polish letters into Alt shortcuts. Option+A now types ą under the same setting at the shell and under Claude Code's flags. US-International-PC also defaults to composition.

What Changed

Credit: #20579 by @eatmoreduck (yu.xia) and #20164 by Alexandre Blause; both original commit identities are included as Co-authored-by trailers. #20510 was reviewed as an alternative, not copied.

Why

The composition setting must apply to non-ASCII letters too. Restricting text to ASCII made ordinary Polish prose impossible after a TUI negotiated kitty keyboard handling.

Linked Issue

Fixes #20171
Fixes #20850
Fixes #20163
Related: #20495; adaptations of #20579 and #20164; alternative policy in #20510.

User trade-offs

There are two intentional behavior changes; this is not a zero-trade-off claim:

  1. In compose mode, Option combinations producing characters such as π, ƒ, or ∫ now type those characters instead of firing the previous kitty Alt shortcut. Configure Left or Right Option as Alt to retain shortcuts on one side and composition on the other; Both retains shortcuts on both sides at the cost of composed typing there.
  2. US-International-PC users on Auto now get composition rather than the previous Alt default. Explicit Alt restores the previous preference.

Uncomposed keys and configured Alt sides still send chords. Report-all/associated-text behavior is unchanged.

Migration / release note

On macOS, Option keys configured for character composition now keep typing those characters inside affected terminal agents, including non-ASCII letters. If an Option shortcut now types a character, open Settings → Terminal → Advanced → Option as Alt (or search Option as Alt). Choose Both for Alt shortcuts on both keys, or Left/Right to keep one key for shortcuts and the other for typing. Off keeps both keys available for composition. These controls already exist; no explicit preference is rewritten.

US-International-PC on Auto now defaults to composition. Chinese Pinyin and Korean 2-Set on Auto already used composition; their default does not change. Standard-US Auto remains Alt. The Option-shortcut tradeoff can still apply to Chinese/Korean users when their input source emits a qualifying composed Option character.

Visual Proof

Same zażółć wcześniej łącznie Chromium key events, Option Off, and flags 5. These are hidden-renderer CDP checks, not physical keyboard tests. Before uses the original policy at e6a41081a3c; after uses this change. The test asserts exact outgoing PTY bytes and rendered terminal output.

Before: composed letters become escape sequences.

Before

After: all words render correctly.

After

Testing

  • Automated tests added and run with ORCA_BACKGROUND_LAUNCH=1.
  • Physical Polish keyboard / real-agent manual test of this combined branch.

macOS validation:

  • Focused keyboard suite: 17 files / 257 tests passed.
  • Independent readiness run: 6 focused files / 136 tests passed; registered Option/native-layout/web-preload reliability command: 9 files / 150 tests passed. These suites overlap; counts are not additive.
  • Fresh Electron build and terminal-option-composed-ascii.spec.ts: all 7 tests passed. Original-policy word test fails with the expected Alt sequences; the fixed build passes.
  • pnpm tc:web, pnpm run check:code-quality:changed, formatting, and git diff --check passed. Changed-code gate: zero new findings across 8 files.
  • Full repository lint/typecheck/test suites and release packaging were not run.

Review

Upstream review evidence (not approvals of this branch)

All reviewed upstream submissions have COMMENTED reviews, not APPROVED reviews.

Readiness checklist

Scoped verdict: PASS for the changed code; no candidate P0/P1/P2 defects. Severity counsel was skipped under the checklist's zero-candidate exception. This does not claim release-wide or all-platform certification.

Category Evidence / boundary
SSH/network Same pane sender and transport; only renderer-selected input bytes change. No live disconnect, half-open, sleep/resume, or reconnect fault injection performed.
Crash/cast/retry/growth Checked Unicode code point replaces an assertion; no new asynchronous state, retries, listeners, retained collections, or teardown paths.
Security/supply chain No dependencies, binaries, install hooks, credentials, shell execution, new network sinks, or wire changes.
Performance Small per-keystroke code-point check; no timers, polling, subprocesses, or rendering state. No latency benchmark claimed.
Functional Polish cases, explicit Alt sides, report-all, releases, supplementary characters, exact PTY bytes, and setting changes covered.
Backcompat/data No persisted schema, migrations, or wire contract changes. No mobile-facing surface touched; web-preload regressions checked. Auto behavior changes as disclosed above.
Platforms/remoting Changed policy remains Mac-only; no path, shell, host-platform, or provider assumptions added. No native Windows/Linux/WSL or SSH runtime test claimed.
Organization Existing classifier and Option policy extended; tests colocated; no parallel subsystem.

Residual verification: physical Polish typing on this branch (M4 Air is available), real Claude/Codex/OpenCode sessions beyond protocol fixtures, and live network fault testing remain unperformed. No evidence of a regression in those scenarios was found.

Agent skill upstream boundary

  • Not applicable: no skill-installer implementation or registry content copied.

Checklist

  • Focused change with root cause, attribution, review cross-references, and user trade-offs.
  • Before/after evidence attached without adding binary files to the diff.
  • Correctness, security, performance, compatibility, and platform/remoting reviewed.
  • Full repository gates and release packaging (targeted validation listed above).

Adapt the composition fix from #20579 and the input-source correction from
#20164. Extend coverage to every Polish letter, live setting changes,
associated text, and Chromium-to-PTY word entry.

Co-authored-by: yu.xia <[email protected]>
Co-authored-by: Alexandre Blause <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 335b9f8c-9743-4c43-9854-b49009e75366

📥 Commits

Reviewing files that changed from the base of the PR and between 0cd05bc and 23fdb41.

📒 Files selected for processing (8)
  • src/renderer/src/components/terminal-pane/terminal-option-shortcut-policy.ts
  • src/renderer/src/components/terminal-pane/terminal-shortcut-option-compose.test.ts
  • src/renderer/src/components/terminal-pane/terminal-shortcut-policy.test.ts
  • src/renderer/src/lib/keyboard-layout/detect-option-as-alt.ts
  • src/renderer/src/lib/keyboard-layout/input-source-id.test.ts
  • src/renderer/src/lib/keyboard-layout/input-source-id.ts
  • src/renderer/src/lib/keyboard-layout/option-as-alt-probe.ts
  • tests/e2e/terminal-option-composed-ascii.spec.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change sends non-ASCII Option-composed characters as literal input when Option is configured as compose. It preserves kitty CSI-u encoding when Option acts as Alt. The character check now handles Unicode code points and surrogate pairs. US International PC is classified as compose instead of meta. Unit and end-to-end tests cover Polish characters, supplementary-plane characters, kitty flags, Alt configuration, and CDP input.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 23fdb

The change preserves composed text for compose-side Option input while retaining explicit Alt shortcuts, with no actionable merge risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation satisfies the linked coding requirements. In terminal-option-shortcut-policy.ts, compose-side Option text now accepts non-ASCII code points and sends the composed character as `se…
Out of Scope Changes check ✅ Passed The changed source files implement the three linked input-handling objectives. The test changes provide regression coverage for those objectives. The comment updates in the layout-detection files docu…
Title check ✅ Passed The title clearly and concisely identifies the terminal fix and the affected Option-composed text, including Polish text.
Description check ✅ Passed The description is detailed and covers the required sections, linked issues, visual proof, testing, trade-offs, compatibility considerations, and checklist status. It also clearly discloses unperforme…
✨ Finishing Touches
📝 Generate docstrings
  • 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.

@pullfrog pullfrog 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.

ℹ️ No critical issues — one minor config-consistency suggestion.

Reviewed changes

  • Widened kitty compose policy — isLayoutComposedCharacter drops the codePoint <= 0x7e ASCII ceiling, so any single printable non-ASCII composition (Polish letters, π, ƒ, ∫, ¡, ≥, supplementary-plane symbols) is sent as raw text on a compose side; C1 controls stay excluded and Array.from counts code points once.
  • US-International-PC now composes — classifyInputSourceId narrows the meta allowlist to plain com.apple.keylayout.US, so US-International-PC resolves to compose under Auto.
  • Tests — unit coverage for all nine Polish letters and uppercase forms under flags 1/5 across compose and Alt sides, supplementary-plane compositions, report-all associated text, and three new live-PTY e2e scenarios; the fingerprint/probe comments were refreshed to match.
  • Verification done in this run — the three changed unit files pass (84 tests), and restoring the old ASCII ceiling makes the new non-ASCII expectations fail, so they are discriminating rather than tautological.

ℹ️ reliability-gates.jsonc still describes the pre-widening test contract

The manifest entries for tests/e2e/terminal-option-composed-ascii.spec.ts and terminal-shortcut-option-compose.test.ts were not updated. The e2e gate still promises "a non-ASCII Option glyph still reaches the application as its alt hotkey", which is now true only when Option is explicitly configured as Alt — the spec sets setMacOptionAsAlt(orcaPage, 'true') for exactly that case — and its 2026-08-16 evidence run still reports "Four live-Electron scenarios passed" while the spec now has seven tests (including the Polish, report-all, and rendered-word scenarios). The manifest's checker validates structure, not assertion text, so this is not a CI failure; it is drift in a reviewed artifact that future gate edits tend to copy forward.

Technical details
# stale reliability-gate text after the compose-policy widening

## Affected sites
- `config/reliability-gates.jsonc:13367-13370` — the `tests/e2e/terminal-option-composed-ascii.spec.ts` `assertionRefs` list: "receives the Option-composed ASCII character" is now broader, and "a non-ASCII Option glyph still reaches the application as its alt hotkey" is now conditional on an explicit Alt setting.
- `config/reliability-gates.jsonc:13553` — the `2026-08-16` `evidenceRuns` summary still says "Four live-Electron scenarios passed" and frames the non-ASCII case as unconditional.

## Required outcome
- The gate text and any refreshed evidence summary describe the widened compose policy and the new tests, and state that non-ASCII Alt+glyph hotkeys now require an explicitly configured Alt side.

## Suggested approach (optional)
- Re-run `pnpm run test:e2e -- tests/e2e/terminal-option-composed-ascii.spec.ts` and add/refresh an `evidenceRuns` entry with the current scenario count; adjust the four `assertionRefs` strings to match the spec's current titles and behavior.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nwparker

Copy link
Copy Markdown
Contributor Author

Settings visual proof for #21082 at 23fdb416d2e:

These are existing controls, not new UI introduced by this PR. Settings → search “Option as Alt” exposes Auto / Both / Left / Right / Off. Auto displays the detected role; Left explains the split. Captured the hidden renderer through CDP from this branch in an isolated profile with ORCA_BACKGROUND_LAUNCH=1. Clicked Auto, Left, Both and Off, then restored Auto.

Existing Auto setting

Existing Left split setting

CJK check: Pinyin and Korean 2-Set already classify as composition under Auto before this PR. The new Option text predicate preserves the IME-owned-event exclusions. 659 focused tests across 46 files passed, including IME, Option, kitty tracking and preview coverage. These screenshots prove settings behavior, not native Chinese/Korean typing or receiving-agent behavior under report-all. Those remain unverified.

@nwparker

Copy link
Copy Markdown
Contributor Author

Additional pre-merge verification at 23fdb416d2e:

  • Fresh Electron E2E build, launched with ORCA_BACKGROUND_LAUNCH=1.
  • 26 rendered tests passed; 4 explicitly Windows-only IME ownership cases skipped on macOS.
  • Suites: terminal-option-composed-ascii, terminal-cjk-ime-committed-text, terminal-korean-preedit-visibility, korean-ime-terminal-shift-enter-commit, and terminal-korean-composing-chord-order.
  • Covers Pinyin conversions, full-width punctuation/digits, Korean preedit and committing chords, all Polish Option letters, mounted-setting updates, configured Alt shortcuts, and report-all associated text.
  • These use Chromium/event replay, not a native input method or real-agent receiver. Native Chinese/Korean testing is still pending; the repository forbids foreground/native-focus testing on the user desktop without an explicit exception. Installed native IMEs and Accessibility availability were checked without changing the system input source.
  • Added a migration/release-note section to the PR description, using the existing UI labels Both / Left / Right / Off and the Settings search route. No new settings UI or preference migration was added.

@nwparker

Copy link
Copy Markdown
Contributor Author

Native M4 Air regression gate

I ran the repository’s native macOS 2-Set Korean terminal suite on the connected M4 Air, with Accessibility enabled and the system input source switched to com.apple.inputmethod.Korean.2SetKorean. The input source was restored to com.apple.keylayout.ABC afterward, and the dedicated checkout was restored to its prior baseline.

Revision Result
PR head 23fdb416d2e 1/3 passed, 2/3 failed, reproducibly
Baseline d7525aa085 3/3 passed

PR-head failures:

  • preserves leading vowels and composes the following syllable: native preedit/commit path failed.
  • flushes each syllable while the next remains in preedit: expected committed 가나, received ㅏ나.

The first test (forwards physical Hangul input as exact PTY bytes) passed once on the PR head, but the full run still failed 2/3; the same two failures repeated on rerun. Baseline passed all three in 46.2 seconds. This is a proven native CJK regression in the PR and blocks merge.

The earlier 26 rendered tests and 659 focused unit tests remain green; they do not cover this native event shape. The likely regression surface is the widened non-ASCII composition predicate in terminal-option-shortcut-policy.ts, which can classify a native Korean IME event differently from the prior ASCII-only policy. Please preserve the native IME path while retaining Unicode Option composition.

@nwparker
nwparker force-pushed the nwparker/polish-stuff branch 3 times, most recently from 516f430 to 23fdb41 Compare September 20, 2026 06:48

@pullfrog pullfrog 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.

Important

The new Hangul jamo clause is only reached when Option is held, so it cannot address the native 2-Set Korean regression the author flagged as blocking. Please re-run the native gate on this head and report the result.

Reviewed changes

  • Hangul jamo classified as IME-owned — isImeOwnedKey now returns true for a single jamo, so resolveTerminalOptionShortcutAction returns null and the press is left to the text-input/IME path.
  • Unit coverage — { key: 'ㅏ', code: 'KeyK' } joins the IME-owned table; ablating the clause makes the case fail, so it is discriminating.

Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:

  • src/renderer/src/components/terminal-pane/terminal-option-shortcut-policy.ts:79 (RIGHT) — line 79 (RIGHT) is not inside a diff hunk

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nwparker

Copy link
Copy Markdown
Contributor Author

Follow-up native validation on the immediate parent and PR head, using the isolated M4 Air with the required foreground launch:

  • Parent e6a41081a3c: 3/3 passed.
  • PR 23fdb416d2e: 12/12 passed across four runs.
  • The same PR build without ORCA_E2E_FOREGROUND=1: 3/3 failed by dropping the first Korean consonant before composition began.

The failed trace had alt=false, ctrl=false, meta=false, kittyFlags=0, and macOptionIsMeta=false, so the Option/kitty change was not involved. The failure was the native IME activation race from an unsafe background launch. I added a guard so this native spec skips unless ORCA_E2E_FOREGROUND=1, matching its isolated-display requirement.

@nwparker
nwparker merged commit 8dee68a into main Sep 20, 2026
35 checks passed
@angelod1as

Copy link
Copy Markdown

@nwparker thanks for this PR. How long until it's released? Thanks :)

@lucasbastianik

Copy link
Copy Markdown

+1

nwparker added a commit that referenced this pull request Sep 24, 2026
…2608)

#21082 widened the kitty composed-text check from ASCII to every printable
codepoint, which is what restored French Option+$ -> €. Nothing pinned a
composed character on a punctuation code: the Polish cases all sit on `Key*`
codes, whose unmodified character the US fallback table also answers, so they
pass even when the layout map is the only source of `characterWithoutOption`.

Reverting the widening fails this case at kitty flags 1, 3, 5 and 7.

Co-authored-by: rasata <[email protected]>
@BrOrlandi

BrOrlandi commented Sep 24, 2026 •

Copy link
Copy Markdown

@angelod1as @lucasbastianik it's out. First release carrying it is v1.4.209 (23 Sep). Note that v1.4.206 and v1.4.207 were published after the merge but do not contain it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants