Skip to content

Conversation

@rabanspiegel
Copy link
Contributor

@rabanspiegel rabanspiegel commented Feb 2, 2026

Mapped Shift+Enter to Ctrl+J in CLI agent terminals so Shift+Enter inserts a new line. Applies only to agent terminal view.

Fixes #636.


Rebased from #657 (original work by @notkainoa).

Files Changed

  • src/renderer/terminal/terminalKeybindings.ts (new)
  • src/renderer/terminal/TerminalSessionManager.ts
  • src/renderer/terminal/SessionRegistry.ts
  • src/renderer/components/TerminalPane.tsx
  • src/renderer/components/ChatInterface.tsx
  • src/renderer/components/MultiAgentTask.tsx
  • src/test/renderer/TerminalSessionManager.test.ts (new)

Feature

  • Adds CTRL_J_ASCII and shouldMapShiftEnterToCtrlJ() in terminalKeybindings.ts
  • Attaches a custom key handler in TerminalSessionManager when mapShiftEnterToCtrlJ is set
  • Sends Ctrl+J (LF) to the PTY and bypasses xterm's default handling for Shift+Enter

Note

Medium Risk
Medium risk because it changes terminal keyboard event handling and refactors PTY input/injection logic; regressions could affect command submission, telemetry, or initial prompt injection behavior.

Overview
Enables Shift+Enter to insert a newline in agent-backed terminal panes by optionally mapping Shift+Enter to Ctrl+J (LF) via an xterm custom key handler.

Threads a new mapShiftEnterToCtrlJ flag from ChatInterface/MultiAgentTask through TerminalPane and SessionRegistry into TerminalSessionManager, and refactors terminal input handling into handleTerminalInput() so newline-insert events bypass enter-press telemetry and pending-injection submission logic.

Adds terminalKeybindings.ts plus a small Vitest suite to validate the keybinding predicate and Ctrl+J encoding.

Written by Cursor Bugbot for commit 347f8fd. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Feb 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Feb 2, 2026 11:52pm

Request Review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

- Add isNewlineInsert parameter to skip injection/telemetry on newline insert
- Rename test file to match module (terminalKeybindings.test.ts)
@rabanspiegel rabanspiegel merged commit 1fa9bc1 into main Feb 3, 2026
4 checks passed
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]: can't input line break in Claude Code

3 participants