Skip to content

fix(terminal): type Option-composed ASCII instead of reporting it as a chord - #14743

Merged
nwparker merged 7 commits into
mainfrom
nwparker/turkish-option-compose
Aug 16, 2026
Merged

nwparker merged 7 commits into
mainfrom
nwparker/turkish-option-compose

Conversation

@nwparker

@nwparker nwparker commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 20 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2003 $\color{#cf222e}{\Huge{\mathbf{−}}}$​62 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1941
Prod 29 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1613 $\color{#cf222e}{\Huge{\mathbf{−}}}$​298 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1315

Fixes #14024.

Problem

On macOS layouts that produce printable ASCII with Option, terminal panes could report the physical Alt chord instead of typing the composed character. Neighboring paths could also lose authoritative IME text, mis-pair press/release events, retain stale layout state after an in-focus input-source switch, or encode incomplete protocol fields.

Fix

  • Separate physical key identity from committed text. Physical identity drives the key report; authoritative commit text drives associated text, including multi-codepoint commits.
  • Keep printable Option-composed ASCII as text when composition owns the key, while preserving configured Alt, readline navigation, shifted layouts, repeats, releases, and negotiated report modes.
  • Leave global legacy Option-as-Alt with the terminal engine; policy-owned configured Alt uses the active layout and keeps legacy encoding under form-only enhancement flags.
  • Reject Dead, Process, Unidentified, composing, and keyCode-229 events from normal shortcut encoding. Native dead-key keydowns keep composition ownership, matching rewritten keyups cannot leak orphan releases, and an explicitly configured Alt side retains its legacy dead-key chord.
  • Encode CapsLock and NumLock modifier bits, filter forbidden C0/C1 controls from associated text, distinguish functional keypad keys from printable keypad text, and retain ISO identities when the layout resolver has no entry.
  • Pin every owed release to the primary identity delivered by its press while retaining live keyup modifiers, so layout invalidation, Shift-up-first, and NumLock changes cannot release a different key.
  • Add ISO/JIS and Space coverage to the native layout snapshot.
  • Subscribe once to the macOS input-source notification, invalidate every live renderer immediately, wait for an older native read to settle, coalesce rapid changes to the latest refresh, and generation-fence stale results. Pending shifted-layout data fails safe to committed text while configured Alt ownership remains authoritative.
  • Keep web and non-macOS behavior as no-op fallbacks.

Representative byte oracles:

  • configured Alt legacy: \x1bq
  • configured Alt dead key: \x1be
  • negotiated Option+P: \x1b[112;3u
  • multi-codepoint commit: \x1b[97;;97:769u
  • CapsLock + Option+Q + associated text: \x1b[113;67;64u
  • ISO key with associated text: \x1b[60;3;124u
  • Option+Space with non-breaking-space commit: \x1b[32;3;160u

Compatibility

  • Main terminal panes and dashboard previews use the same encoding rules.
  • The change is client-side and adds no remote schema, stream opcode, or host requirement.
  • SSH, remote-runtime, daemon, folder-workspace, and mobile snapshot paths retain their existing contracts.
  • Linux and Windows do not install the macOS notification path; web retains a no-op subscription.
  • The helper remains macOS-only, universal arm64/x86_64, and packaged beside the executable.

Verification

  • Fresh protocol, native-integration, and readiness audits found no remaining P0/P1/P2 issues.
  • Registered Option/layout reliability slice: 9 files, 126 tests passed.
  • Changed keyboard, IME, preview, notification, preload, and web slice: 20 files, 366 tests passed; the broader reliability slice passed 27 files and 486 tests.
  • A 128-case keyboard-flag matrix passed commit/report/release invariants across flags 0–31, including printable and functional keypad identities.
  • Full suite before the test-only file split: 5,653 files and 53,087 tests passed, with 21 files and 119 tests skipped. Post-split runs passed 5,653 files and 53,086 tests but each hit one unrelated load-sensitive timeout; both affected files passed immediately in isolation (14/14 daemon tests and 1/1 Electron cookie test).
  • Live Electron IME gate: 3 passed; the opt-in real-agent scenario remained skipped.
  • Rendered terminal validation produced 1b 62 for global legacy Option+B and 1b5b3131323b3375 for negotiated Option+P.
  • A fresh Electron instance visibly preserved ordinary ASCII, Shift characters, Backspace editing, Left Arrow insertion, Enter submission, and terminal output.
  • Changed-code and type-aware audits, React checks, typecheck, the 85-gate reliability manifest, max-lines ratchet, the macOS keyboard helper build, and the production Electron build passed.

The reliability manifest now records the input invariant, exact deterministic command, notification fanout/cleanup assertions, and the event-driven performance budget.

Remaining gaps

  • CDP cannot synthesize the native macOS Option text-service path or a physical input-source switch, so exact composition on every ANSI/ISO/JIS layout still needs hardware soak coverage.
  • The opt-in real-agent IME scenario remains skipped; deterministic Electron/PTY scenarios cover the committed-byte contract.
  • Only printable ASCII is treated as composed text. A non-ASCII Option glyph (£ on Option+3, ¢ on Option+4, ∞, π, ∫, œ) still reaches a kitty-negotiated pane as its Alt chord, so it cannot be typed there under any Option-as-Alt setting. This is fix(terminal): forward Option hotkeys to kitty-keyboard TUIs on compose layouts #8031's tradeoff unchanged — those chords are what TUI Option hotkeys bind — and every other terminal instead makes Option-as-Alt a plain binary switch. Panes that never negotiated the protocol still compose normally, as do dead keys on every pane.

Follow-up two-host validation

  • A second Apple Silicon macOS host checked out the exact pushed SHA, built and ran the native helper against its live ABC layout, passed 16 keyboard/IME/preview files and 279 tests, and passed all three TypeScript projects. Its Node 26 run was an additional out-of-matrix stress check.
  • Production-style Electron runs passed exact PTY-byte composition, CJK commit transactions, macOS system-key remaps, the complete chord/action oracle, macOS viewport navigation, and shifted Cyrillic input under keyboard-protocol reporting.
  • The existing floating-terminal tab-switch E2E passes in a fresh app but is order-sensitive because its helper refocuses the first mounted textarea instead of the visible active tab. The PR does not change that floating-terminal surface; all affected keyboard paths pass independently.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cd260a85-d70a-4776-aa05-a795ab4a0dd6

📥 Commits

Reviewing files that changed from the base of the PR and between 84a6503 and 2ce2fa1.

📒 Files selected for processing (3)
  • config/reliability-gates.jsonc
  • src/renderer/src/components/terminal-pane/terminal-option-shortcut-policy.ts
  • tests/e2e/terminal-option-composed-ascii.spec.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • config/reliability-gates.jsonc
  • src/renderer/src/components/terminal-pane/terminal-option-shortcut-policy.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The change adds a native macOS keyboard-layout helper and exposes validated snapshots through IPC and preload APIs. Renderer layout resolution now supports native Shift and Option mappings, change notifications, stale-refresh fencing, and Option-key location tracking. Terminal paths use shared Kitty CSI-u encoding, layout-aware Option shortcuts, deferred releases, and richer IME modifier data. macOS build and packaging pipelines now compile, sign, bundle, and validate the helper.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.21% which is insufficient. The required threshold is 80.00%. 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 changes directly address issue #14024 by accepting @ and $ generated by the macOS Turkish keyboard layout in Orca.
Out of Scope Changes check ✅ Passed The native helper, layout notifications, preload wiring, shortcut policy, packaging, and tests all support the stated macOS Option-input fix.
Title check ✅ Passed The title clearly summarizes the primary change: treating macOS Option-composed ASCII as typed text instead of a physical Alt chord.
Description check ✅ Passed The description clearly explains the problem, fix, linked issue, compatibility, testing, limitations, and validation; it is substantially complete despite omitting some template checklist sections.
✨ Finishing Touches 💡 1
📝 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.

@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: 1

🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/terminal-shortcut-policy.ts (1)

75-87: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Shorten the helper comment.

These lines add a long historical explanation. Keep one concise comment that states the ASCII composition rule.

As per coding guidelines: “Comments must be concise, non-obvious, and brief—prefer one line.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ed0b5c0-a280-4138-a0b1-ca173a534470

📥 Commits

Reviewing files that changed from the base of the PR and between 2b10767 and 1127b9b.

📒 Files selected for processing (2)
  • src/renderer/src/components/terminal-pane/terminal-shortcut-option-compose.test.ts
  • src/renderer/src/components/terminal-pane/terminal-shortcut-policy.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.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b01a2fc1-8116-4ebf-80e1-4bd2f6e659fd

📥 Commits

Reviewing files that changed from the base of the PR and between 1127b9b and b75ac26.

📒 Files selected for processing (35)
  • config/electron-builder.config.cjs
  • config/scripts/build-keyboard-layout-macos.mjs
  • config/scripts/build-native-for-platform.mjs
  • config/scripts/electron-builder-config.test.mjs
  • config/scripts/package-electron-runtime-contract.test.mjs
  • config/scripts/run-electron-vite-dev.mjs
  • native/keyboard-layout-macos/main.swift
  • package.json
  • src/main/ipc/app.ts
  • src/main/ipc/macos-keyboard-layout-snapshot.test.ts
  • src/main/ipc/macos-keyboard-layout-snapshot.ts
  • src/preload/api/app-api.ts
  • src/preload/index.ts
  • src/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsx
  • src/renderer/src/components/dashboard-popout/preview-terminal-key-handler.ts
  • src/renderer/src/components/dashboard-popout/preview-terminal-shortcuts.test.ts
  • src/renderer/src/components/dashboard-popout/preview-terminal-shortcuts.ts
  • src/renderer/src/components/terminal-pane/keyboard-handlers.test.ts
  • src/renderer/src/components/terminal-pane/keyboard-handlers.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-kitty-commit-encoding.ts
  • src/renderer/src/components/terminal-pane/terminal-kitty-keyboard-flags.ts
  • src/renderer/src/components/terminal-pane/terminal-option-kitty-release.test.ts
  • src/renderer/src/components/terminal-pane/terminal-option-kitty-release.ts
  • 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/components/terminal-pane/terminal-shortcut-policy.ts
  • src/renderer/src/lib/keyboard-layout/layout-base-character.test.ts
  • src/renderer/src/lib/keyboard-layout/layout-base-character.ts
  • src/renderer/src/lib/keyboard-layout/option-as-alt-probe.test.ts
  • src/renderer/src/lib/keyboard-layout/option-as-alt-probe.ts
  • src/renderer/src/lib/keyboard-layout/option-key-location-state.test.ts
  • src/renderer/src/lib/keyboard-layout/option-key-location-state.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/keyboard-layout-snapshot.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 1 remains after this review.

Comment on lines +58 to +60
function readArg(name) {
const index = args.indexOf(name)
return index === -1 ? undefined : args[index + 1]

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Validate the --output value.

If --output is last, readArg returns undefined. If --output precedes --single-arch, it treats that option as the output path. The script can then fail in path.dirname or write a helper named --single-arch in the working directory. Reject a missing or option-like value.

Proposed fix
 function readArg(name) {
   const index = args.indexOf(name)
-  return index === -1 ? undefined : args[index + 1]
+  if (index === -1) {
+    return undefined
+  }
+  const value = args[index + 1]
+  if (!value || value.startsWith('--')) {
+    throw new Error(`Missing value for ${name}`)
+  }
+  return value
 }
📝 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.

Suggested change
function readArg(name) {
const index = args.indexOf(name)
return index === -1 ? undefined : args[index + 1]
function readArg(name) {
const index = args.indexOf(name)
if (index === -1) {
return undefined
}
const value = args[index + 1]
if (!value || value.startsWith('--')) {
throw new Error(`Missing value for ${name}`)
}
return value
}

@nwparker
nwparker force-pushed the nwparker/turkish-option-compose branch from b75ac26 to 745a562 Compare August 16, 2026 07:44
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@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: 1

🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/terminal-ime-native-text-forwarder.ts (1)

71-71: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add lock-state coverage to the synthetic forwarder tests. Production callers pass xterm’s live KeyboardEvent unchanged. Test helpers omit getModifierState; add CapsLock and NumLock cases to detect regressions.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d255e776-4970-46cd-b94c-da5c79f7fa54

📥 Commits

Reviewing files that changed from the base of the PR and between c066a55 and 745a562.

📒 Files selected for processing (47)
  • config/electron-builder.config.cjs
  • config/reliability-gates.jsonc
  • config/scripts/build-keyboard-layout-macos.mjs
  • config/scripts/build-native-for-platform.mjs
  • config/scripts/electron-builder-config.test.mjs
  • config/scripts/package-electron-runtime-contract.test.mjs
  • config/scripts/run-electron-vite-dev.mjs
  • native/keyboard-layout-macos/main.swift
  • package.json
  • src/main/ipc/app.test.ts
  • src/main/ipc/app.ts
  • src/main/ipc/macos-keyboard-layout-change-notifications.test.ts
  • src/main/ipc/macos-keyboard-layout-change-notifications.ts
  • src/main/ipc/macos-keyboard-layout-snapshot.test.ts
  • src/main/ipc/macos-keyboard-layout-snapshot.ts
  • src/preload/api/app-api.ts
  • src/preload/app-restart-checkpoint-routing.test.ts
  • src/preload/index.ts
  • src/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsx
  • src/renderer/src/components/dashboard-popout/preview-terminal-key-handler.ts
  • src/renderer/src/components/dashboard-popout/preview-terminal-shortcuts.test.ts
  • src/renderer/src/components/dashboard-popout/preview-terminal-shortcuts.ts
  • src/renderer/src/components/terminal-pane/keyboard-handlers.test.ts
  • src/renderer/src/components/terminal-pane/keyboard-handlers.ts
  • src/renderer/src/components/terminal-pane/terminal-ime-kitty-commit-encoding.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-kitty-csi-u-encoding.test.ts
  • src/renderer/src/components/terminal-pane/terminal-kitty-csi-u-encoding.ts
  • src/renderer/src/components/terminal-pane/terminal-option-kitty-release.test.ts
  • src/renderer/src/components/terminal-pane/terminal-option-kitty-release.ts
  • 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/components/terminal-pane/terminal-shortcut-policy.ts
  • src/renderer/src/lib/keyboard-layout/layout-base-character.test.ts
  • src/renderer/src/lib/keyboard-layout/layout-base-character.ts
  • src/renderer/src/lib/keyboard-layout/option-as-alt-probe.test.ts
  • src/renderer/src/lib/keyboard-layout/option-as-alt-probe.ts
  • src/renderer/src/lib/keyboard-layout/option-key-location-state.test.ts
  • src/renderer/src/lib/keyboard-layout/option-key-location-state.ts
  • src/renderer/src/web/web-preload-api-ui.test.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/keyboard-layout-events.ts
  • src/shared/keyboard-layout-snapshot.ts
  • src/shared/terminal-kitty-keyboard-flags.ts
🚧 Files skipped from review as they are similar to previous changes (24)
  • config/scripts/electron-builder-config.test.mjs
  • src/renderer/src/components/dashboard-popout/preview-terminal-shortcuts.ts
  • src/renderer/src/components/terminal-pane/keyboard-handlers.test.ts
  • src/renderer/src/lib/keyboard-layout/option-key-location-state.test.ts
  • package.json
  • src/renderer/src/web/web-preload-api.ts
  • config/scripts/build-keyboard-layout-macos.mjs
  • src/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsx
  • src/main/ipc/macos-keyboard-layout-snapshot.test.ts
  • config/scripts/run-electron-vite-dev.mjs
  • config/scripts/package-electron-runtime-contract.test.mjs
  • src/renderer/src/components/terminal-pane/terminal-option-kitty-release.test.ts
  • src/renderer/src/components/dashboard-popout/preview-terminal-shortcuts.test.ts
  • config/electron-builder.config.cjs
  • src/shared/keyboard-layout-snapshot.ts
  • src/preload/index.ts
  • src/renderer/src/components/terminal-pane/terminal-option-kitty-release.ts
  • src/renderer/src/components/terminal-pane/terminal-shortcut-policy.test.ts
  • src/renderer/src/components/dashboard-popout/preview-terminal-key-handler.ts
  • src/renderer/src/lib/keyboard-layout/option-key-location-state.ts
  • src/renderer/src/lib/keyboard-layout/layout-base-character.ts
  • config/scripts/build-native-for-platform.mjs
  • src/renderer/src/components/terminal-pane/terminal-shortcut-policy.ts
  • src/renderer/src/components/terminal-pane/keyboard-handlers.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review.

The Option-compose fix had unit coverage only. This drives a live Electron
pane whose kitty flags are armed by the application's own CSI > 1 u and
asserts the bytes at the pty boundary: composed `@` and Shift-layer `\`
arrive as text, configured Option-as-Alt still reports the layout-resolved
chord, and a non-ASCII glyph still reaches the app as its alt hotkey.
Restoring the pre-fix policy fails exactly the two composed-text scenarios.

Also records the ASCII rule's rationale where the rule lives, not only in a
test comment.
…pshot

The native helper computed an Option and Option+Shift character for every
key, shipped both over IPC, validated them in the parser and cached them in
the renderer — but no production caller ever asked for them. Only the base
and Shift layers are read, and Shift is the one the web layout map cannot
supply, which is why the helper exists at all.

Removing them halves the helper's UCKeyTranslate work per key and drops the
option parameter that six signatures were threading through for nobody.
@nwparker
nwparker merged commit 9f3a912 into main Aug 16, 2026
54 checks passed
AmethystLiang pushed a commit that referenced this pull request Aug 17, 2026
…a chord (#14743)

* fix(terminal): preserve Option-composed ASCII input

* fix(terminal): preserve Option keyboard protocol semantics

* fix(terminal): complete Option keyboard event encoding

* fix(terminal): harden Option input encoding

* fix(terminal): close keyboard protocol fallback gaps

* test(terminal): prove Option-composed ASCII reaches the pty end to end

The Option-compose fix had unit coverage only. This drives a live Electron
pane whose kitty flags are armed by the application's own CSI > 1 u and
asserts the bytes at the pty boundary: composed `@` and Shift-layer `\`
arrive as text, configured Option-as-Alt still reports the layout-resolved
chord, and a non-ASCII glyph still reaches the app as its alt hotkey.
Restoring the pre-fix policy fails exactly the two composed-text scenarios.

Also records the ASCII rule's rationale where the rule lives, not only in a
test comment.

* refactor(terminal): drop the unread Option layers from the layout snapshot

The native helper computed an Option and Option+Shift character for every
key, shipped both over IPC, validated them in the parser and cached them in
the renderer — but no production caller ever asked for them. Only the base
and Shift layers are read, and Shift is the one the web layout map cannot
supply, which is why the helper exists at all.

Removing them halves the helper's UCKeyTranslate work per key and drops the
option parameter that six signatures were threading through for nobody.
kunsanglee added a commit to kunsanglee/orca that referenced this pull request Aug 18, 2026
stablyai#15017 gave the composing-chord deferral an owner and a ceiling, and stablyai#14743
moved MacOptionAsAlt into terminal-option-shortcut-policy.ts. Both landed on
the lines this branch had rewritten.

The deferral now goes through main's `deferredChordSender`, which blur and
teardown can drop, and which abandons a chord after 10 s rather than waiting
forever. The release-recovered path keeps its own `composing` argument, since a
chord answered for at keyup has no live event to read it from.

`runShortcutAction` gained main's Option-release arming. Its narrowed event type
now carries the modifier flags the tracker reads; a snapshotted chord already
held them. The arming is keydown-only in effect — the Option policy returns null
for a composing event, which every recovered chord is.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…a chord (stablyai#14743)

* fix(terminal): preserve Option-composed ASCII input

* fix(terminal): preserve Option keyboard protocol semantics

* fix(terminal): complete Option keyboard event encoding

* fix(terminal): harden Option input encoding

* fix(terminal): close keyboard protocol fallback gaps

* test(terminal): prove Option-composed ASCII reaches the pty end to end

The Option-compose fix had unit coverage only. This drives a live Electron
pane whose kitty flags are armed by the application's own CSI > 1 u and
asserts the bytes at the pty boundary: composed `@` and Shift-layer `\`
arrive as text, configured Option-as-Alt still reports the layout-resolved
chord, and a non-ASCII glyph still reaches the app as its alt hotkey.
Restoring the pre-fix policy fails exactly the two composed-text scenarios.

Also records the ASCII rule's rationale where the rule lives, not only in a
test comment.

* refactor(terminal): drop the unread Option layers from the layout snapshot

The native helper computed an Option and Option+Shift character for every
key, shipped both over IPC, validated them in the parser and cached them in
the renderer — but no production caller ever asked for them. Only the base
and Shift layers are read, and Shift is the one the web layout map cannot
supply, which is why the helper exists at all.

Removing them halves the helper's UCKeyTranslate work per key and drops the
option parameter that six signatures were threading through for nobody.
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.

Codex in Orca does not accept @ and $ from Turkish keyboard layout

1 participant