Repository navigation
fix(desktop): translate macOS ⌥⌫ (Option+Backspace) to delete-previous-word in terminal - #5615
Draft
github-actions[bot] wants to merge 1 commit into
Draft
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
…in terminal Option+Backspace (⌥⌫) is a standard macOS text-editing shortcut for deleting the previous word, but the terminal's line-edit chord translator only handled Alt+Arrow (word movement) and Cmd+Backspace (delete to start of line). ⌥⌫ fell through to xterm's kitty encoder and did nothing in the shell. Map it to ESC+DEL (\x1b\x7f), the readline/zsh backward-kill-word sequence, matching the word-boundary behavior of native macOS inputs. Refs #5604, Closes #2222
|
Ready to review this PR? Stage has broken it down into 2 individual chapters for you:
Chapters generated by Stage for commit 3fc268a on Jul 11, 2026 10:43pm UTC. |
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.
What this addresses
Issue #5604 is a tracker consolidating many stale
terminal-inputissues. Rather than a single bug, it lists ~25 sub-issues. This PR takes one concrete, reproducible, and cleanly fixable item from that list — #2222 (macOS-native text-editing shortcuts) — and closes the specific gap that still reproduces.The bug
translateLineEditChord(apps/desktop/src/renderer/lib/terminal/line-edit-translations.ts) already implements most of the macOS shortcuts #2222 asks for:The
altbranch only handledArrowLeft/ArrowRight, so Option+Backspace fell through the translator, got CSI-u encoded by xterm's kitty keyboard protocol, and did nothing useful in the shell — exactly the "Current Terminal Behavior: Nothing" row in #2222.Root cause
translateLineEditChord'sisMac && onlyMod(event, "alt")block mapped the two arrow keys but neverBackspace, even though the siblingmetabranch already handledBackspace(delete-to-start).The fix
Add one mapping in the
altbranch:ESC+DEL(\x1b\x7f) is the readline/zsh backward-kill-word sequence. It respects word boundaries the same way native macOS text inputs do, and it's consistent across bash and zsh (unlike ⌘⌫'s\x15, whose meaning differs per shell).Tests
line-edit-translations.test.ts:\x1b\x7f. Before the fix it returnednull(bug reproduced); after the fix it passes.All 9 tests in the file pass. (The 10 failing tests elsewhere in the terminal dir are pre-existing
document is not definedDOM-environment issues inappearance.test.ts, unrelated to this change.)Refs #5604
Closes #2222
Summary by cubic
Adds macOS Option+Backspace (⌥⌫) support in the terminal so it deletes the previous word, translating to ESC+DEL and matching native behavior. Closes #2222; addresses the
terminal-inputtracker in #5604.\x1b\x7f) on macOS for backward-kill-word.Written for commit 3fc268a. Summary will update on new commits.