You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(terminal): forward Ctrl+M as kitty CSI-u for Grok multiline toggle - #9932
1) What's broken today (ELI5).
In Grok Build inside an Orca terminal, Ctrl+M is supposed to toggle multiline input. It does not work (behaves like Enter / does nothing useful). Users cannot switch multiline mode with the chord Grok documents.
2) What this PR does (ELI5).
Orca now sends Ctrl+M the same special way it already sends Ctrl+Enter: as a kitty CSI-u sequence that keeps Ctrl+M different from Enter. Grok can finally see the toggle chord.
3) Tradeoffs / regressions — honest answer.
Concern
Assessment
Shell users who rely on Ctrl+M = Enter (CR)
Ctrl+M will now send CSI-u \x1b[109;5u instead of bare CR. Enter still submits. Same design choice as Ctrl+Enter (#2418): prefer TUI disambiguation over historical control-char collapse.
Other TUIs that bind Ctrl+M via CSI-u
Benefit.
Cmd+M on macOS
Untouched (window minimize). Only Ctrl+M.
Platforms
Same policy on macOS / Linux / Windows.
No settings, menus, or agent-config changes.
Summary
Bug: Grok Build Ctrl+M (toggle multiline) does not work in Orca’s terminal (#9736).
Root cause: In terminal encoding, Ctrl+M is historically CR (0x0d), the same byte as Enter. xterm.js collapses Ctrl+M to bare CR, so the TUI cannot distinguish “toggle multiline” from “submit”.
This is the same class of problem already fixed for Ctrl+Enter in terminal-shortcut-policy.ts (#2418):
Why a separate test file: the main policy test file is already at the repo max-lines ratchet; AGENTS.md forbids max-lines disables.
Manual (expected after this PR)
Open Grok Build in an Orca terminal (macOS).
Focus the composer.
Press Ctrl+M.
Before: acts like Enter / no multiline toggle.
After: multiline mode toggles as outside Orca.
Code map
Location
Change
terminal-shortcut-policy.ts
Ctrl+M → \x1b[109;5u
terminal-shortcut-ctrl-m.test.ts
New focused regression tests
ELI5
Ctrl+M and Enter used to look identical to the terminal (both “carriage return”). Grok needs them to look different so Ctrl+M can mean “multiline,” not “send.” We label Ctrl+M with a special code, like we already did for Ctrl+Enter.
User-regression-tradeoffs
Intended: Ctrl+M reaches agent TUIs (Grok) as a distinct chord.
Shell Ctrl+M-as-Enter: may stop inserting CR; use Enter instead (same as Ctrl+Enter tradeoff).
Cmd+M (macOS): unchanged.
Checklist notes (CONTRIBUTING / AGENTS)
Area
Notes
Cross-platform
Uses ctrlKey (not meta). Cmd+M not remapped.
SSH / remote
PTY input bytes; encoding independent of remote OS.
Agents
Helps Grok multiline (and any TUI binding Ctrl+M via CSI-u). No agent-config change.
Git / providers
N/A
Performance
One extra predicate on the shortcut path.
UI
No visual change.
Security
No new IPC.
Tests
Focused new file + full policy suite green. No max-lines disable.
Test plan
Unit: Ctrl+M → \x1b[109;5u
Unit: non-plain chords still passthrough
Full policy suite green
Optional live Grok smoke on macOS
Out of scope
Other historical Ctrl+letter collapses (Ctrl+J = LF, etc.) without a concrete TUI need
The terminal shortcut resolver now recognizes plain Ctrl+M, including events where the key value is remapped but the physical code is KeyM. It returns a kitty CSI-u sendInput action with the sequence \x1b[109;5u. Tests cover this behavior and verify that Ctrl+M with Shift or Meta, or without Ctrl, returns null.
Severity of issue fixed: Low
Merge Risk: Low · up to 3b5f1
Some keyboard layouts and Kitty-aware applications may receive incorrect chords or key events. These bounded issues warrant correction or owner acceptance before merge.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title names the main change: plain Ctrl+M is now forwarded as a kitty CSI-u sequence so Grok Build's multiline toggle can work. It follows the conventional commit format and matches the raw summar…
Description check
The description covers most required template sections. It has an ELI5, a what-changed explanation through the root cause and fix, a why with tradeoffs and alternatives, testing evidence with commands…
Linked Issues check
Issue #9736 requires Ctrl+M to work for Grok Build's multiline toggle in the Orca terminal. The reviewed head adds a branch in resolveTerminalShortcutAction (terminal-shortcut-policy.ts). The branch…
Out of Scope Changes check
The whole-PR code change is one new Ctrl+M branch in terminal-shortcut-policy.ts (+13 lines, confirmed by diff against the merge base). The supporting change is a focused test file for that branch. Bo…
Docstring Coverage
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check
Explanation
The title names the main change: plain Ctrl+M is now forwarded as a kitty CSI-u sequence so Grok Build's multiline toggle can work. It follows the conventional commit format and matches the raw summary and PR objectives. It is concise and specific.
Full details: Description check
Explanation
The description covers most required template sections. It has an ELI5, a what-changed explanation through the root cause and fix, a why with tradeoffs and alternatives, testing evidence with commands and a file table, and a risk and regression discussion. It links issue #9736 with 'Fixes #9736', though the template's 'Fixes #' line is filled in outside the template layout. Gaps: the Visual Proof section has no before/after video or screenshot, and the author describes the manual test as expected behavior rather than a performed test. The Risk section has no explicit 'Level' value (Low, Medium, or High), and the description does not say how to revert. The AI Disclosure, Agent skill upstream boundary, and Checklist items are not filled in or checked. The description is mostly complete, so the check passes, but the author should address these gaps.
Full details: Linked Issues check
Explanation
Issue #9736 requires Ctrl+M to work for Grok Build's multiline toggle in the Orca terminal. The reviewed head adds a branch in resolveTerminalShortcutAction (terminal-shortcut-policy.ts). The branch matches plain Ctrl+M (ctrlKey set; metaKey, altKey, and shiftKey unset; key is m or M, or code is KeyM). It returns sendInput with \x1b[109;5u, so Ctrl+M no longer reaches the TUI as bare CR. The diff confirms this code. The raw summary states that new tests cover the encoding and the non-plain chord cases, and the reported targeted run passed 39/39. The issue has no further acceptance criteria. Grok's handling of the CSI-u sequence is outside this repository. The live Grok smoke test is unchecked, so the end-to-end toggle behavior is not independently confirmed.
Full details: Out of Scope Changes check
Explanation
The whole-PR code change is one new Ctrl+M branch in terminal-shortcut-policy.ts (+13 lines, confirmed by diff against the merge base). The supporting change is a focused test file for that branch. Both directly implement #9736. The PR description also lists the documented tradeoff: shell users who relied on Ctrl+M as CR lose that behavior, and Enter still submits. This follows from the intended change and is not an unrelated change. Cmd+M and other Ctrl-letter mappings are not changed, and no settings, launch, or agent-config changes appear in the summary.
Full details: Docstring Coverage
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Tip
🎯 Customize your risk assessments
Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.
✅ Automatic approvals, with your rules
Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
The resolver excludes altKey and must leave Cmd+M unchanged, but these cases are not asserted. Add both tests to prevent future regressions in the modifier boundary.
ℹ️ Review info⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2b174d35-10e9-46b6-b487-171578b12d1d
📥 Commits
Reviewing files that changed from the base of the PR and between 39b124c and 51bc677.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
Gate Ctrl+M CSI-u on the active pane's keyboard capability.
Local Windows ConPTY panes withhold Kitty keyboard reporting from CSI-u-blind CLIs. Ctrl+Enter already sends \r unless Kitty flags or trusted consumer authority allow CSI-u, but Ctrl+M bypasses that policy. A non-Grok ConPTY shell can therefore receive \x1b[109;5u instead of carriage return and fail to process Ctrl+M.
Suggested fix
- // Why: lazy so local ConPTY lookup runs only for Ctrl+Arrow and Ctrl+Enter.+ // Why: lazy so local ConPTY lookup runs only for Ctrl+Arrow, Ctrl+Enter, and Ctrl+M.
isLocalWindowsConptyPane?: () => boolean,
if (
event.ctrlKey &&
!event.metaKey &&
!event.altKey &&
!event.shiftKey &&
(event.key === 'm' || event.key === 'M' || event.code === 'KeyM')
) {
+ const localWindowsConpty = isLocalWindowsConptyPane?.() === true+ const canSendCsiU =+ !localWindowsConpty ||+ (getKittyKeyboardFlagsActivePane?.() ?? 0) > 0 ||+ hasCtrlEnterCsiUAuthority?.() === true- return { type: 'sendInput', data: '\x1b[109;5u' }+ return { type: 'sendInput', data: canSendCsiU ? '\x1b[109;5u' : '\r' }
}
📝 Committable suggestion
‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
Ctrl+M is historically CR (same as Enter). xterm collapses it to bare CR, so
Grok Build never sees a distinct chord for multiline toggle. Emit kitty CSI-u
\\x1b[109;5u (modifier 5 = Ctrl), matching the existing Ctrl+Enter handling.
Fixesstablyai#9736
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Honor negotiated repeat reporting.
When the application enables Kitty event types, holding Ctrl+M sends every repeat as another press. Applications that distinguish presses from repeats can trigger the action repeatedly. (sw.kovidgoyal.net)
Encode repeats using the active flags, as terminal-kitty-csi-u-encoding.ts does.
Send a matching release for the captured Ctrl+M press.
When Kitty event-type reporting is enabled, the captured press does not reach xterm, so the keyup guard can suppress its release. Applications that track pressed keys receive an M press without a matching release and cannot clear that key’s pressed state.
This branch has not been deployed
No deployments
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
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.
🧑🤝🧑 Impact & ELI5
1) What's broken today (ELI5).
In Grok Build inside an Orca terminal, Ctrl+M is supposed to toggle multiline input. It does not work (behaves like Enter / does nothing useful). Users cannot switch multiline mode with the chord Grok documents.
2) What this PR does (ELI5).
Orca now sends Ctrl+M the same special way it already sends Ctrl+Enter: as a kitty CSI-u sequence that keeps Ctrl+M different from Enter. Grok can finally see the toggle chord.
3) Tradeoffs / regressions — honest answer.
\x1b[109;5uinstead of bare CR. Enter still submits. Same design choice as Ctrl+Enter (#2418): prefer TUI disambiguation over historical control-char collapse.No settings, menus, or agent-config changes.
Summary
Bug: Grok Build Ctrl+M (toggle multiline) does not work in Orca’s terminal (#9736).
Root cause: In terminal encoding, Ctrl+M is historically CR (
0x0d), the same byte as Enter. xterm.js collapses Ctrl+M to bare CR, so the TUI cannot distinguish “toggle multiline” from “submit”.This is the same class of problem already fixed for Ctrl+Enter in
terminal-shortcut-policy.ts(#2418):// Ctrl+Enter → \x1b[13;5u (Enter codepoint 13, Ctrl modifier 5)Grok’s multiline toggle needs the analogous encoding for M:
// Ctrl+M → \x1b[109;5u (codepoint 109 = 'm', Ctrl modifier 5)Fix: In
resolveTerminalShortcutAction, intercept plain Ctrl+M (keym/M orcodeKeyM) andsendInputthe kitty CSI-u chord.Fixes #9736
Evidence
Automated
pnpm exec vitest run --config config/vitest.config.ts \ src/renderer/src/components/terminal-pane/terminal-shortcut-ctrl-m.test.ts \ src/renderer/src/components/terminal-pane/terminal-shortcut-policy.test.ts39/39 passed
terminal-shortcut-ctrl-m.test.ts(new)\x1b[109;5u; shift/meta/no-ctrl staynullterminal-shortcut-policy.test.tsWhy a separate test file: the main policy test file is already at the repo max-lines ratchet; AGENTS.md forbids
max-linesdisables.Manual (expected after this PR)
Code map
terminal-shortcut-policy.ts\x1b[109;5uterminal-shortcut-ctrl-m.test.tsELI5
Ctrl+M and Enter used to look identical to the terminal (both “carriage return”). Grok needs them to look different so Ctrl+M can mean “multiline,” not “send.” We label Ctrl+M with a special code, like we already did for Ctrl+Enter.
User-regression-tradeoffs
Checklist notes (CONTRIBUTING / AGENTS)
ctrlKey(not meta). Cmd+M not remapped.Test plan
\x1b[109;5uOut of scope
AI code-review summary
Made so Grok multiline works in Orca 🐋