Skip to content

fix: forward Ctrl+Enter as kitty CSI-u so TUIs can cue instead of send - #6383

Merged
Jinwoo-H merged 2 commits into
stablyai:mainfrom
mmarabel:gatsby74/issue-5966-control-enter-droid-cli
Jun 25, 2026
Merged

Jinwoo-H merged 2 commits into
stablyai:mainfrom
mmarabel:gatsby74/issue-5966-control-enter-droid-cli

Conversation

@mmarabel

Copy link
Copy Markdown
Contributor

Fixes #5966.

Summary

Inside an Orca embedded terminal, Control+Enter was delivered to TUIs as a bare \r (plain Enter) instead of the distinct Ctrl+Enter chord. Programs that probe the kitty keyboard handshake (CSI ? u) — e.g. the Factory Droid CLI, which uses Ctrl+Enter to cue/queue a message rather than send it — therefore behaved as if the user pressed Enter. The same Droid build works in macOS Terminal / iTerm2.

Root cause

Orca advertises kitty keyboard support and the renderer's capture-phase listener (keyboard-handlers.ts) already forwards Shift+Enter as \x1b[13;2u via sendInput. Ctrl+Enter had no sibling branch, so it fell through to xterm, which collapses it to bare CR.

Change

terminal-shortcut-policy.ts — added a sibling branch that intercepts Ctrl+Enter (no other modifiers) and forwards the kitty CSI-u \x1b[13;5u (modifier code 5 = Ctrl) directly to the PTY. No Windows fallback yet; unlike #2418's Codex-on-PowerShell inertness for Shift+Enter, no Windows TUI is known to drop the CSI-u form for Ctrl+Enter.

Tests

terminal-shortcut-policy.test.ts — covers macOS/Linux/Windows all emitting \x1b[13;5u, plus regression guards for Ctrl+Shift+Enter and Ctrl+Cmd+Enter.

Verification

  • vitest terminal-shortcut-policy.test.ts -> 17/17
  • vitest terminal-pane/ -> 1096/1096
  • oxlint + tsgo web typecheck -> clean
  • Manually verified in pnpm dev against the Droid CLI: Ctrl+Enter cues instead of sending.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The terminal shortcut resolver now maps Ctrl+Enter to a kitty CSI-u sequence by returning a sendInput action with \x1b[13;5u when only Ctrl is pressed. The test suite adds coverage for this mapping on both platform configurations and verifies that Ctrl+Enter with extra modifiers returns null.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary, root cause, change, tests, and verification, but omits required Screenshots, AI Review Report, Security Audit, and Notes sections. Add the missing template sections and briefly fill in the AI review, security audit, screenshots/no visual change, and platform-specific notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: forwarding Ctrl+Enter as kitty CSI-u instead of plain Enter.
Linked Issues check ✅ Passed The Ctrl+Enter CSI-u passthrough and regression tests match issue #5966's expected behavior and preserve the distinct chord.
Out of Scope Changes check ✅ Passed The changes stay focused on Ctrl+Enter passthrough and related tests, with no unrelated code paths introduced.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Jinwoo-H
Jinwoo-H self-requested a review June 25, 2026 23:15

@Jinwoo-H Jinwoo-H left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is a good targeted compatibility fix for #5966.

I verified the terminal shortcut path and added an Electron e2e assertion so Ctrl+Enter is covered through the real keydown-to-PTY write path. The implementation is consistent with Orca's existing Shift+Enter terminal shim and keeps other modified Enter chords falling through.

Validation:

  • terminal shortcut unit test passed
  • lint and typecheck passed
  • Electron terminal shortcut e2e passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: bc4145af-9956-4112-96c7-1c700ab6d4b5

📥 Commits

Reviewing files that changed from the base of the PR and between 1c57fe7 and 56bbeff.

📒 Files selected for processing (3)
  • src/renderer/src/components/terminal-pane/terminal-shortcut-policy.test.ts
  • src/renderer/src/components/terminal-pane/terminal-shortcut-policy.ts
  • tests/e2e/terminal-shortcuts.spec.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/components/terminal-pane/terminal-shortcut-policy.test.ts
  • src/renderer/src/components/terminal-pane/terminal-shortcut-policy.ts

Comment on lines +502 to +505
await installMainProcessPtyWriteSpy(electronApp)
await waitForActivePanePtyId(orcaPage)

await pressAndExpectWrite(orcaPage, electronApp, 'Control+Enter', '\x1b[13;5u')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert against the active pane PTY, not any PTY write.

Line 503 fetches the active PTY id but drops it, and pressAndExpectWrite only checks for a matching payload. That means this test still passes if \x1b[13;5u is written to the wrong PTY/tab. Please thread the returned ptyId into the assertion and match the { id, data } pair so the regression coverage actually proves routing to the active terminal pane.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Control+Enter in Droid CLI inside Orca terminal acts like plain Enter (sends instead of cueing)

2 participants