Conversation
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…nup (pingdotgg#14553) Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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. Grok 4.7 via Cursor cloud agent. Co-authored-by: maco <macodev00@users.noreply.github.com>
CodeRabbit docstring coverage on the functions this diff touches was 33.33%. Add JSDoc to the key-encoding helpers and the test functions beside them. Behavior is unchanged. From apps/web at Node 24.13.1: vp test run --project unit src/terminal/ghostty/keyCodes.test.ts src/terminal/ghostty/runtimeAbi.test.ts src/terminal/ghostty/core.test.ts Result: 3 files passed, 33 tests passed. vp run --filter @t3tools/web typecheck Result: tsc --noEmit passed (exit 0). vp fmt apps/web/src/terminal/ghostty/keyCodes.ts apps/web/src/terminal/ghostty/core.ts apps/web/src/terminal/ghostty/core.test.ts Result: finished, no further edits. vp lint apps/web/src/terminal/ghostty/keyCodes.ts apps/web/src/terminal/ghostty/core.ts apps/web/src/terminal/ghostty/core.test.ts Result: exit 0. One pre-existing warning in ghosttyCellText (unicorn no-new-array). Grok 4.7 via Cursor cloud agent. Co-authored-by: maco <macodev00@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On a German Mac layout,
@is Option+L. The desktop terminal (and the web app, which shares this Ghostty surface) forwarded Option as Alt into libghostty-vt. That WASM build is not Darwin, so Ghostty'smacos-option-as-alt = falsepath never runs, and DEC 1036 turns Option+L intoESC @(readline set-mark). The same encoding drops the rest of that Option layer (€,~,[]{}|,\).Fixes pingdotgg#13046. Supersedes pingdotgg#13222, which Macroscope re-verdicted Not approved on 2026-10-01: marking Alt consumed still left the raw Alt bit set, and tests never checked the WASM sequence.
Change
A lone macOS Option that produces one character is consumed, and those consumed bits are cleared from the raw modifier mask before encoding. Shift is cleared only when it participated in that Option composition. 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.Clearing the raw Alt bit is required on this build. modifyOtherKeys mode 2 and Kitty report-all still encode a raw Alt bit as Alt even when Alt is also marked consumed. The tests encode all three masks (raw Alt, raw Alt plus consumed Alt, and the mask
encodeKeysends) through the vendored WASM encoder.Scope and approval
Triaged bug pingdotgg#13046 (
accepted). 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
apps/webat5b73e922d, Node 24.13.1:Result: 3 files passed, 33 tests passed.
Result:
tsc --noEmitpassed (exit 0).Result: finished, no further edits.
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.Not checked: a physical German keyboard or Electron on macOS. The assertions pass a platform string into the same encoder the desktop app uses.
Grok 4.7 via Cursor cloud agent.