Repository navigation
Conversation
On macOS, Option+L is @. The terminal forwarded Option as Alt into a non-Darwin libghostty-vt build, so DEC 1036 sent ESC @. Marking Alt consumed still left the raw Alt bit set, and modifyOtherKeys mode 2 encoded that as an Alt sequence. Consume a lone macOS Option that produced a character, and clear those consumed bits from the raw modifier mask before encoding. Ctrl, Meta, Option+arrow, and a lone Shift stay intact. There is no Option-as-Meta setting; this matches Terminal.app with that option off. Tests that stub navigator.platform restore the previous own descriptor, and delete the temporary own property when platform was inherited, including when the stubbed call throws.
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused fix to existing Ghostty terminal key encoding for macOS Option-composed characters, with non-macOS behavior preserved and extensive unit/WASM coverage. It adds no schema, configuration, deployment, security, billing, or static-analysis changes. Notes:
You can add or adjust custom eligibility rules. Learn more. |
Dismissing prior approval to re-evaluate 4aeae6d
|
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 configurationConfiguration used: Repository: pingdotgg/t3code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change updates Ghostty key modifier handling for character-producing Option input on macOS and iOS. It adds platform-aware modifier masks, passes both raw and consumed masks to key encoding, and tests the behavior across keyboard modes and platforms. ChangesOption-Key Encoding
Priority: ⬆️ High Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix · Severity of issue fixed: Medium Possibly related PRs
Merge Risk: ⚪ Minimal · up to This change makes Option-produced characters, such as @ on a German Mac keyboard, type correctly in the desktop terminal. Ctrl, Meta, and Option+arrow behavior is kept, and Linux and Windows are unchanged. No merge-blocking problems were found. It was not tested on a real German keyboard on macOS. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change is limited to interpreting keyboard modifiers within an existing terminal session. No additional access or authority was identified. Remaining uncertainty concerns failure recovery and behavior beyond the existing terminal-input callback. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Built the desktop app locally (main + this PR at |
|
I can also confirm, running this locally with a Croatian keyboard layout, all the option+key special chars type properly: |
Problem
On a German Mac layout,
@is Option+L. The desktop terminal and the web app share this Ghostty surface, and both forwarded Option as Alt into libghostty-vt. That WASM build is not Darwin, so Ghostty'smacos-option-as-alt = falsepath never runs. DEC 1036 turns Option+L intoESC @(readline set-mark), so nothing is typed. The same encoding drops the rest of that Option layer (€,~,[]{}|,\).Electron does not set
AltGraphfor Option, so the existing AltGr bypass does not apply. Option+arrow word motion is a separate path.Fixes #13046
Supersedes #14576
Why
Marking Alt consumed still leaves the raw Alt bit set. modifyOtherKeys mode 2 and Kitty report-all read that bit and emit an Alt sequence even when Alt is also consumed. The raw Alt bit has to be cleared when Option composition is consumed. Shift is cleared only when it participated in that composition. A lone Shift stays in the raw mask.
#14576 left
navigator.platformunrestored whenever it was inherited. Node exposesplatformon the prototype, so saving only an own-property descriptor did nothing and later tests kept the stub. Cleanup now restores a saved own descriptor, and deletes the temporary own property when there was none, insidefinally, including when the stubbed call throws.What Changed
A lone macOS Option that produces one character is consumed, and those consumed bits are cleared from the raw modifier mask before encoding. Ctrl, Meta, Option+arrow, and a lone Shift stay intact, including Shift+letter under modifyOtherKeys mode 2.
There is no Option-as-Meta setting. This matches Terminal.app with "Use Option as Meta key" off, and Ghostty's default. Option+letter chords that previously became
ESCplus the unshifted letter now type the composed character.Scope and approval
Triaged bug #13046 (
acceptedby juliusmarminge). The change is the terminal key encoder in the web surface the desktop app embeds. Mobile's native terminal is a different path and is unchanged.Verification
From commit
4aeae6d73, Node 24.13.1 (v24.13.1).Formatter, from the repo root:
Result, exit 0:
No further edits.
Lint, from the repo root:
Result, exit 0. The only warning is the existing
no-new-arraynote inghosttyCellText:Unit tests, from
apps/web:Result, exit 0:
Typecheck, from the repo root:
Result, exit 0:
The WASM tests assert the encoded bytes, not only the consumed-mod bitmask:
ESC @/CSI 64;3 u. Consumed Alt without clearing the raw bit is still an Alt sequence under modifyOtherKeys mode 2 (CSI 27;3;64~). The maskencodeKeysends encodes@.\): leaving the composing Shift in the raw mask encodesCSI 27;2;92~. Clearing it encodes\.CSI 27;2;65~.GhosttyTerminalCore.encodeKeyon a MacIntel platform writes@,€,|, and\in the default, modifyOtherKeys, and Kitty disambiguate modes, and the Kitty report-all sequence\x1b[64::108;;64u. Linux and Windows Alt still prefix ESC. Ctrl+C and Option+Left are unchanged.navigator.platformis restored after every encodeKey test. An inherited platform (no own descriptor) is deleted again after a thrown stub, and an own descriptor is put back.Limitations: checked on Linux x86_64, Node 24.13.1. In this runtime
navigator.platformis the inherited valueLinux x86_64, which is the case that previously leaked an own property.Not checked on a physical German keyboard or Electron on macOS. The assertions pass a platform string into the same encoder the desktop app uses.
Option+letter chords that used to send
ESCplus the unshifted letter now type the composed character. There is no setting to keep Option as Meta.UI Changes
None visual. This changes the bytes the terminal key encoder sends for macOS Option compositions. There is no layout or rendering change to screenshot.
Checklist