Repository navigation
iOS: add Return shortcut to terminal accessory bar #6101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
def28d1
de81b41
d77b2e5
fe38ae1
24a89bc
51c760b
de3d8d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -210,6 +210,11 @@ public enum TerminalInputAccessoryAction: Int, CaseIterable, Sendable { | |
| /// Appended at the end so existing persisted raw values (user accessory bar | ||
| /// order/enabled set) are preserved. | ||
| case composer | ||
| /// Send a carriage return (Enter). Appended at the end so existing persisted | ||
| /// raw values (which are the `Int` rawValues, stored as `builtin.<n>`) stay | ||
| /// stable; its default on-bar position is curated separately in | ||
| /// ``defaultConfigurableOrder``. | ||
| case returnKey | ||
| var title: String { | ||
| title(isMacRemote: false) | ||
| } | ||
|
|
@@ -234,6 +239,8 @@ public enum TerminalInputAccessoryAction: Int, CaseIterable, Sendable { | |
| return String(localized: "terminal.input_accessory.title.escape", defaultValue: "Esc") | ||
| case .tab: | ||
| return String(localized: "terminal.input_accessory.title.tab", defaultValue: "Tab") | ||
| case .returnKey: | ||
| return "⏎" | ||
| case .ctrlC: | ||
| return "^C" | ||
| case .ctrlD: | ||
|
|
@@ -288,6 +295,7 @@ public enum TerminalInputAccessoryAction: Int, CaseIterable, Sendable { | |
| case .composer: return "terminal.inputAccessory.composer" | ||
| case .escape: return "terminal.inputAccessory.escape" | ||
| case .tab: return "terminal.inputAccessory.tab" | ||
| case .returnKey: return "terminal.inputAccessory.return" | ||
| case .upArrow: return "terminal.inputAccessory.up" | ||
| case .downArrow: return "terminal.inputAccessory.down" | ||
| case .leftArrow: return "terminal.inputAccessory.left" | ||
|
|
@@ -360,14 +368,16 @@ public enum TerminalInputAccessoryAction: Int, CaseIterable, Sendable { | |
| } | ||
| } | ||
|
|
||
| var output: Data? { | ||
| public var output: Data? { | ||
| switch self { | ||
| case .control, .alternate, .command, .shift, .zoomOut, .zoomIn, .paste, .composer: | ||
| return nil | ||
| case .escape: | ||
| return Data([0x1B]) | ||
| case .tab: | ||
| return Data([0x09]) | ||
| case .returnKey: | ||
| return Data([0x0D]) // CR (Enter) | ||
| case .tilde: | ||
| return Data([0x7E]) // ~ | ||
| case .pipe: | ||
|
|
@@ -450,10 +460,10 @@ public enum TerminalInputAccessoryAction: Int, CaseIterable, Sendable { | |
|
|
||
| /// The default on-bar arrangement of the configurable shortcuts: the leading | ||
| /// modifier/paste controls, then the high-traffic agent and control keys (Tab, | ||
| /// Esc, ^C/^D, the Claude/Codex launchers, the arrow keys, Clear), then the | ||
| /// punctuation and navigation keys, then the trailing zoom controls. Esc sits | ||
| /// immediately to the right of Tab so the two most common terminal keys are | ||
| /// adjacent. Curated independently of the enum's `rawValue` order so the | ||
| /// Esc, Return, ^C/^D, the Claude/Codex launchers, the arrow keys, Clear), then | ||
| /// the punctuation and navigation keys, then the trailing zoom controls. Esc and | ||
| /// Return sit immediately to the right of Tab so the most common terminal keys | ||
| /// are adjacent. Curated independently of the enum's `rawValue` order so the | ||
| /// default bar can be arranged without perturbing the persisted identifiers, | ||
| /// which are the `rawValue`s. | ||
| /// | ||
|
|
@@ -464,6 +474,7 @@ public enum TerminalInputAccessoryAction: Int, CaseIterable, Sendable { | |
| defaultLeadingActions + [ | ||
| .tab, | ||
| .escape, | ||
| .returnKey, | ||
| .ctrlC, .ctrlD, | ||
| .claude, .codex, | ||
| .upArrow, .downArrow, .leftArrow, .rightArrow, | ||
|
|
@@ -480,6 +491,7 @@ public enum TerminalInputAccessoryAction: Int, CaseIterable, Sendable { | |
| switch self { | ||
| case .escape: return String(localized: "terminal.shortcut.name.escape", defaultValue: "Escape") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Rule Used: Flag production user-facing text that is not fully... (source) |
||
| case .tab: return String(localized: "terminal.shortcut.name.tab", defaultValue: "Tab") | ||
| case .returnKey: return String(localized: "terminal.shortcut.name.return", defaultValue: "Return") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This introduces the new user-facing key Useful? React with 👍 / 👎. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add the matching string-catalog entry for Line 496 introduces a new user-facing localization key, but this review cohort does not include the corresponding 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| case .upArrow: return String(localized: "terminal.shortcut.name.upArrow", defaultValue: "Up Arrow") | ||
| case .downArrow: return String(localized: "terminal.shortcut.name.downArrow", defaultValue: "Down Arrow") | ||
| case .leftArrow: return String(localized: "terminal.shortcut.name.leftArrow", defaultValue: "Left Arrow") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For users who have already launched a v3 toolbar config, adding
.returnKeytodefaultConfigurableOrderonly appends it todisplayOrder;TerminalAccessoryConfiguration.initloads the existing non-nilcmux.terminal.toolbar.enabled.v3set, andTerminalAccessoryLayoutReducer.loadkeeps that set unchanged, so the new Return button is hidden after upgrade unless the user resets or manually enables it. If this shortcut is meant to be added to the terminal bar for existing users, the v3 migration/load path needs to force-enable this new ID or bump the persisted schema.Useful? React with 👍 / 👎.