Skip to content

Fix Codex Shift+Enter on Windows - #2418

Merged
Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/bug-shift-enter-does-nothing-in-codex-inside-win
May 20, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/bug-shift-enter-does-nothing-in-codex-inside-win

Conversation

@Jinwoo-H

Copy link
Copy Markdown
Contributor

Summary

Fixes #2412.

On Windows, Orca now sends Esc+Enter (\x1b\r) for bare Shift+Enter in terminal panes instead of the CSI-u \x1b[13;2u sequence that Codex ignores inside PowerShell. macOS and Linux keep the existing CSI-u behavior.

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Additional verification run:

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/terminal-shortcut-policy.test.ts src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts
  • pnpm exec electron-vite build --mode e2e
  • SKIP_BUILD=1 pnpm exec playwright test tests/e2e/terminal-shortcuts.spec.ts --config=tests/playwright.config.ts --project=electron-headless -g "Shift\+Enter writes" --reporter=line
  • pnpm run typecheck:web
  • git diff --check
  • Manual node-pty repro with real codex-cli 0.132.0 under Windows PowerShell: old \x1b[13;2u produced helloworld; new \x1b\r rendered hello and world on separate composer lines.

Note: the broader all terminal chords reach the PTY or fire their action Playwright spec still closes the Electron page later during pane action checks in this Windows environment. The new focused regression covers the changed Shift+Enter behavior directly.

AI Review Report

Reviewed the terminal keyboard routing from the window-level handler through resolveTerminalShortcutAction to PTY writes. Main risks checked:

  • Windows-only behavior is gated by navigator.userAgent.includes('Windows').
  • macOS/Linux keep the previous \x1b[13;2u sequence.
  • Cmd/Ctrl+Shift+Enter pane expand remains separate from bare Shift+Enter.
  • Remote/SSH input still uses the same PTY send path; only the bytes for this platform-specific chord change.
  • Existing kitty keyboard advertisement remains enabled for non-Windows enhanced key sequences.

Added unit and Playwright coverage for the Windows byte sequence and preserved non-Windows expectations.

Security Audit

No new command execution, auth, filesystem, dependency, IPC channel, or path handling is introduced. The change only alters the string sent to an already-active PTY for a user-initiated terminal key chord. Clipboard/paste handling is unchanged.

Notes

This does not change paste behavior. Normal terminal paste still goes through xterm/bracketed paste. Orca's agent draft paste path may append a plain Enter when explicitly asked to submit after pasting; that is separate from the interactive Shift+Enter keybinding fixed here.

@Jinwoo-H

Copy link
Copy Markdown
Contributor Author

Additional Windows e2e evidence after opening the PR:

  • Ran a temporary Playwright spec against the built Orca Electron app that launched real codex inside Orca, accepted Codex's trust prompt in the temp e2e repo, typed hello, pressed Shift+Enter, typed world, and asserted the Codex composer rendered the two lines separately.
  • Command: SKIP_BUILD=1 pnpm exec playwright test tests/e2e/codex-shift-enter-temp.spec.ts --config=tests/playwright.config.ts --project=electron-headless --reporter=line
  • Result: 1 passed (22.5s)

The temporary spec was removed after the verification so it does not affect the PR diff.

@Jinwoo-H
Jinwoo-H merged commit 956320e into main May 20, 2026
2 checks passed
@Jinwoo-H
Jinwoo-H deleted the Jinwoo-H/bug-shift-enter-does-nothing-in-codex-inside-win branch May 20, 2026 08:06
nwparker added a commit that referenced this pull request Jul 11, 2026
)

* fix(terminal): send CSI-u Shift+Enter to kitty TUIs (droid) on Windows (#7620)

On Windows, Shift+Enter was always sent as the Alt+Enter byte ESC+CR (added in
#2418 for Codex, which reads win32-input-mode and ignores CSI-u). droid speaks
the kitty keyboard protocol, parses CSI-u directly, and treats ESC+CR as a plain
Enter — so Shift+Enter SUBMITTED the message instead of inserting a newline.
droid works in other terminals (Windows Terminal, Warp) because those honor
win32-input-mode / kitty; Orca (xterm.js) withholds kitty from local Windows
ConPTY panes and emits neither.

Make the Windows Shift+Enter byte pane-aware: latch whether a pane's program
advertised the kitty keyboard protocol (query CSI ? u, push CSI > .. u, or set
CSI = .. u) and send CSI-u (\x1b[13;2u) to those panes, keeping the
Codex-compatible ESC+CR for win32-input-mode-only TUIs. Non-Windows is unchanged
(always CSI-u).

Verified end-to-end against the real droid and Codex CLIs through the actual
production functions: droid now newlines, Codex still newlines.

* fix(terminal): route Windows Shift+Enter safely for Droid

---------

Co-authored-by: Neil <[email protected]>
Co-authored-by: Neil <[email protected]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
) (stablyai#7668)

* fix(terminal): send CSI-u Shift+Enter to kitty TUIs (droid) on Windows (stablyai#7620)

On Windows, Shift+Enter was always sent as the Alt+Enter byte ESC+CR (added in
stablyai#2418 for Codex, which reads win32-input-mode and ignores CSI-u). droid speaks
the kitty keyboard protocol, parses CSI-u directly, and treats ESC+CR as a plain
Enter — so Shift+Enter SUBMITTED the message instead of inserting a newline.
droid works in other terminals (Windows Terminal, Warp) because those honor
win32-input-mode / kitty; Orca (xterm.js) withholds kitty from local Windows
ConPTY panes and emits neither.

Make the Windows Shift+Enter byte pane-aware: latch whether a pane's program
advertised the kitty keyboard protocol (query CSI ? u, push CSI > .. u, or set
CSI = .. u) and send CSI-u (\x1b[13;2u) to those panes, keeping the
Codex-compatible ESC+CR for win32-input-mode-only TUIs. Non-Windows is unchanged
(always CSI-u).

Verified end-to-end against the real droid and Codex CLIs through the actual
production functions: droid now newlines, Codex still newlines.

* fix(terminal): route Windows Shift+Enter safely for Droid

---------

Co-authored-by: Neil <[email protected]>
Co-authored-by: Neil <[email protected]>
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]: Shift+Enter does nothing in Codex inside Windows PowerShell terminal

1 participant