Repository navigation
feat(app): mac terminal keys work in terminals, and shift+enter is a newline in claude code - #118
Merged
Merged
Conversation
…newline in claude code ⇧↵ is sent as CSI 13;2u instead of a plain Enter, and berth's tmux turns on extended-keys (tmux 3.2+), so a program that asked for modified keys (Claude Code) gets Shift+Enter while a shell still gets Enter. On a Mac, ⌥←/→ move a word (ESC b/f), ⌘←/→ go to the line's ends (^A/^E) and ⌘⌫ deletes back to its start (^U), as in Ghostty and iTerm2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
sean-brydon
approved these changes
Oct 15, 2026
This branch was successfully 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.
In a Shipyard terminal, ⇧↵ submitted in Claude Code instead of starting a new line, and the Mac's line-editing keys didn't work.
Why: both renderers send a plain
\rfor ⇧↵. Even if they hadn't, berth's tmux hadextended-keysoff, so it turned a modified Enter back into\r. ⌥←/→ arrived asCSI 1;3D/Cand ⌘←/→ asCSI 1;9D/C, which neither a shell nor Claude Code reads as word or line moves, and ⌘⌫ was a plain backspace.What changes
app/src/lib/terminal-keys.ts(+ unit tests): ⇧↵ →CSI 13;2uon every platform. On a Mac only, ⌥←/→ →ESC b/ESC f, ⌘←/→ →^A/^Eand ⌘⌫ →^U, as in Ghostty's macOS defaults and iTerm2's natural text editing. The Linux app keeps its Ctrl keys for the shell. The app's own ⌘⌥ arrows and ⌥1–5 are untouched.terminal-view.tsx: a capture listener on the terminal host sends these through the same input path as typed keys, ahead of the renderer.internal/box/sessions.go:set -s extended-keys on(guarded to tmux 3.2+). tmux then sends a modified key only to a program that asked for one (xterm modifyOtherKeys, which Claude Code requests), so bash still gets a plain Enter for ⇧↵. I checked tmux 3.6 by hand: it ignores the kitty keyboard request; modifyOtherKeys is what counts.Tested
TestAttachPassesShiftEnter: the program getsCSI 27;2;13~. Without the config line it gets0d(plain Enter).e2e/terminal-keys.spec.ts(ghostty and xterm) asserts the exact bytes sent. Without the terminal-view change it fails, getting;3D.go vet ./...,go test -race ./internal/box/,pnpm test(500 pass),tsc,typecheck:plugins,check:titles,check:csp,pnpm build,tsc -p e2e,docs-sitebuild.Note: an agent that's already running asked for modified keys while tmux ignored the request, so ⇧↵ works for it only after it restarts.
🤖 Generated with Claude Code