Skip to content

Enable Option shortcuts for ABC keyboards in Auto mode - #24528

Merged
nwparker merged 2 commits into
mainfrom
nwparker/option-or-option
Oct 2, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/option-or-option

Conversation

@nwparker

@nwparker nwparker commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​888 $\color{#cf222e}{\Huge{\mathbf{−}}}$​284 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​604
Prod 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​140 $\color{#cf222e}{\Huge{\mathbf{−}}}$​79 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​61

ELI5

With Auto on an ABC keyboard, Option+. now reaches the terminal application as a shortcut instead of typing ≥. The default setting stays Auto. Off still types accents and symbols; Left or Right reserves one Option key for each use.

What Changed

Auto now treats the exact macOS ABC input-source ID like the existing U.S. ID. Extended, international, custom, and IME sources still compose characters. Explicit Both, Off, Left, and Right settings take precedence, including in terminals already open when the input source changes.

If macOS cannot identify the active source, Auto keeps composition. The preference fallback reads the backing layout only after confirming a selected keyboard layout; it cannot promote an IME’s underlying ABC layout into an Alt default. Native snapshot invalidation and existing input/release handling stay in place.

Terminal settings explain the choices in all supported languages, identify ABC/U.S. accurately, and correct the Chinese Right label. Added punctuation and live-layout regression coverage.

Why

ABC and U.S. should receive the same terminal policy: on the tested macOS 26.3.1 system, their native layout data was byte-for-byte identical, with matching results for 512 translations and the checked dead-key sequences. The previous ABC distinction did not follow a different character mapping.

Changing every layout or forcing Left would override unrelated text-entry choices. The exact ABC alias solves the shortcut problem while keeping explicit composition and international layouts available. Missing-source detection stays conservative because an IME can expose a U.S.-shaped backing layout.

Linked Issue

Related: #1205 and #20171. Preserves explicit composition decisions from #21082 and #22608, and the IME/release boundaries reviewed in #14743, #23584, and #8810.

Visual Proof

Same actual ABC input source and Auto setting, captured from hidden macOS Electron renderers:

Before:

Before

After:

After

Testing

  • Tested the rendered settings control and Chromium keyboard input in hidden macOS Electron instances; confirmed the real native ABC source and updated Auto description separately.
  • Automated tests added/updated for punctuation, modifier sides, active versus backing input sources, failed detection, and stale layout reads.

Passed: pnpm tc, changed-code quality gate, focused lint/format checks, localization catalog/extraction/runtime checks, the Electron E2E build, 322 focused unit tests, and 19 Electron tests. Four Linux-only exact-byte IME tests were skipped on macOS.

The new Electron check retains the same mounted terminal across ABC → international → ABC → IME backed by ABC → ABC → unknown → ABC. It asserts exact Option+. press/release bytes under negotiated flags, the Auto description and persisted setting, explicit Off text, and split Option behavior. Existing legacy punctuation and CJK committed-text checks also pass.

No physical native-IME composition, actual application effort-screen switching, Windows/Linux desktop, or live SSH run was performed. E2E typecheck has existing repository errors; neither changed E2E file has diagnostics. Full lint, full tests, and packaging remain for CI.

Review

Independent review checked the exact input-source allowlist, selected IME precedence, conservative failure handling, modifier sides, active-layout encoding, paired releases, and translated labels. No outstanding findings.

Agent skill upstream boundary

  • Not applicable.

Notes

This intentionally changes Auto for ABC: users who want Option-produced text on both sides can select Off, or Left/Right for a split. The setting default is still Auto; existing explicit preferences are not migrated. The input policy runs on the client through existing terminal routes for local and SSH panes, worktrees and folder workspaces. No transport or execution-host changes.

Checklist

  • This PR is small and focused
  • Explained ELI5, before/after, mechanism, and approach
  • Before/after screenshots attached
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and shortcut impact considered
  • Targeted checks and build pass; full gates remain for CI

@nwparker
nwparker requested a review from brennanb2025 as a code owner October 2, 2026 05:40
@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Refines keyboard layout detection and adds punctuation input handling.

The PR does not appear safe to merge while Auto prevents ABC users from typing Option-composed characters.

Findings

  1. P1 ABC composition is lost ▶
  2. P2 Guidance is missing from search ▶
  3. P2 Detected layout label reads awkwardly ▶

Summary

The PR explains macOS Option shortcut choices, translates the guidance, changes native input-source classification, and expands punctuation and Electron coverage.

  • ABC is now treated as an Alt-producing layout in Auto, which loses its previously supported Option-composed text.
  • The two earlier settings-guidance findings remain outstanding.

Reviews (2) · Last reviewed commit: "Enable Auto Option shortcuts on ABC keyb..."

Comment on lines +85 to +87
{translate(
'settings.terminal.optionShortcutHint',
'If Option shortcuts type symbols, choose Left, Right, or Both. Left or Right keeps the other Option key available for accents and symbols.'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Guidance is missing from search The new hint tells users about Option shortcuts typing symbols and keeping a key available for accents, but the setting’s search entry still uses its older description and keywords. Searching settings for “symbols” or “accents” therefore does not find this control. Add those terms to its search entry.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +25 to +26
'settings.terminal.optionLayoutCompose',
'layout uses Option to compose characters like @, €, [, ]'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Detected layout label reads awkwardly On a composing layout, Auto now displays “Auto — detected: layout uses Option to compose characters…”. The replacement no longer names the detected layout category, making the result harder to understand. Use a clear category phrase here and in its translations.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 48418e99-ccd0-4145-9d22-f36cd3293281

📥 Commits

Reviewing files that changed from the base of the PR and between cdfdadf and d82e555.

📒 Files selected for processing (9)
  • src/renderer/src/components/settings/TerminalMacKeyboardSection.tsx
  • src/renderer/src/components/terminal-pane/terminal-option-punctuation.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • tests/e2e/terminal-option-composed-ascii.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The terminal settings now use translated labels for detected Option-key layouts and append translated guidance about choosing Left, Right, or Both for shortcuts. English, Spanish, French, Japanese, Korean, and Chinese translations were added. New unit and end-to-end tests cover punctuation input across Option modes, keyboard flags, key sides, and layout characters.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to d82e5

This change improves the Option-as-Alt setting text across supported languages and adds test coverage. No merge-blocking risk was found.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (6 skipped: 6… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title accurately identifies the ABC keyboard and Auto-mode shortcut behavior. It does not mention the related settings guidance and punctuation test coverage, but it remains clearly related to the…
Description check ✅ Passed The description follows the repository template and includes the required explanation, change details, rationale, issue references, visual proof, testing results, review notes, scope considerations, a…
Full details: Docstring Coverage

Explanation

Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (6 skipped: 6 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

ℹ️ Minor suggestions only — nothing blocking.

Reviewed changes

  • Terminal settings copy — TerminalMacKeyboardSection.tsx localizes the three detected-layout labels under new settings.terminal.* keys, removes the "non-US layout" wording, and appends the Option split-side hint to the row description.
  • Option punctuation unit coverage — new terminal-option-punctuation.test.ts pins resolveTerminalOptionShortcutAction and the kitty release tracker across Alt modes, repeats/releases, legacy escape bytes, IME ownership, non-Mac input, and active-layout encoding.
  • Option punctuation E2E coverage — terminal-option-composed-ascii.spec.ts gains side-aware synthetic dispatch and three macOS specs driving the settings control, CDP Chromium punctuation, and legacy kitty bytes.
  • Locale catalogs — new keys added to all six locales; Chinese Right corrected from 正确的 to 右边.

The unit expectations match the real policy and release-tracker branches, the E2E byte expectations line up with encodeTerminalOptionKittyEvent output, and the new English entries are prunable against their call-site fallbacks so the runtime-required catalog needs no regeneration.

ℹ️ Nitpicks

  • en.json settings.terminal.optionLayoutCompose renders as "Auto — detected: layout uses Option to compose characters like @, €, [, ]". Adding an article ("this layout uses Option…") would match the noun-phrase form of the other two detected labels and read more cleanly.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

"1c337bef4a": "控制按 JIS 日元 (¥) 键是否发送反斜杠 (\\\\)。",
"3fe1c5bfe0": "关",
"c73d510938": "正确的",
"c73d510938": "右边",

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.

This corrects a genuine mistranslation (Right was rendered as 正确的, "correct"), and the repo already guards this class of fix against bootstrap re-translation in zh-technical-literal-mistranslations.test.ts. Consider adding an assertion there (expect(findByKey(zh, 'c73d510938')).toBe('右边')) so it cannot silently regress.

@nwparker nwparker changed the title Explain Option shortcut settings and cover punctuation input Enable Option shortcuts for ABC keyboards in Auto mode Oct 2, 2026
// ABC and US share the standard layout; international variants retain Option composition.
const META_INPUT_SOURCE_IDS: readonly string[] = [
'com.apple.keylayout.us',
'com.apple.keylayout.abc'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 ABC composition is lost On macOS ABC with Option as Alt set to Auto, this new allowlist entry treats Option as Alt. Pressing Option+A then sends an Alt chord instead of the å produced by the layout, so ABC users can no longer type Option-composed letters and accents in the terminal.

@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 new issues found in the new commit. Not approving only because the earlier non-blocking zh regression-guard thread is still open.

Reviewed changes

Incremental re-review of the production-behavior commit 56f951ec since the prior pullfrog review at d82e555.

  • ABC reclassified as standard — input-source-id.ts allowlists com.apple.keylayout.abc beside .us, so Auto enables Option-as-Meta for ABC while every other layout (ABC Extended, US Extended, US-International-PC, Polish Pro, IMEs) keeps composing.
  • Main-process probe prefers the selected source — readSelectedInputSourceFromJson/readKeyboardInputSourceId now return a tagged inputSource vs keyboardLayout, prefer an active IME over its US-shaped backing layout, read AppleCurrentKeyboardLayoutInputSourceID only when no input-mode record exists, and return no signal on probe failure instead of blindly falling back.
  • Renderer probe stays conservative on macOS — the probe short-circuits to unknown whenever native identity is missing on macOS, disabling the US-fingerprint fallback there; non-Mac still uses the fingerprint.
  • Settings copy, locales, and E2E helpers — optionLayoutAlt now reads "ABC or U.S.", the split-side hint is reworded, all six catalogs were updated, and the Option-key E2E helpers were extracted into terminal-option-key-input.ts with a new Auto ABC/IME/side spec.

The allowlist and parser branches line up with real AppleSelectedInputSources dumps (which mirror the active source, so an active IME surfaces as an Input Mode record rather than its ABC backing layout), and the changed English strings still match their call-site fallbacks so en-runtime-required needs no regeneration.

Pullfrog  | Fix it ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit 306b457 into main Oct 2, 2026
39 checks passed
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