Skip to content

feat(tui): add backslash+Enter newline for terminals without Shift+Enter #810

Description

@arvind1705

Feature Description

Support an intuitive way to insert newlines in the TUI on terminals where Shift+Enter cannot be distinguished from Enter.

Problem

On macOS iTerm2 with default settings, Shift+Enter sends the same byte sequence (\r) as Enter. As a result, pressing Shift+Enter submits the prompt instead of inserting a newline.

Ctrl+J can insert a newline, but it is not intuitive or easily discoverable for multi-line input.

This is a common interaction supported by Claude Code, Warp, and OpenAI Codex CLI.

Steps to Reproduce

  1. Open iTerm2 on macOS with default settings.
  2. Run cmd.
  3. Type a partial message.
  4. Press Shift+Enter.
  5. The prompt is submitted instead of inserting a newline.

Expected Behavior

  • Enter submits the prompt.
  • Shift+Enter inserts a newline where supported by the terminal.
  • Users should have an intuitive way to insert newlines on terminals where Shift+Enter cannot be distinguished from Enter.
  • Ctrl+J should continue to work.

Environment

  • macOS
  • iTerm2 with default settings
  • No Kitty keyboard protocol / CSI-u

Use Case

Multi-line prompts are useful for detailed instructions, code snippets, structured requests, and prompts containing multiple paragraphs. An intuitive newline shortcut makes composing these prompts significantly easier.

Additional Context

The issue is caused by the terminal's input encoding rather than a configurable iTerm2 shortcut: Shift+Enter and Enter are both received as \r.

A similar terminal compatibility issue and newline interaction has been addressed by hermes-agent:

NousResearch/hermes-agent#44115

How important is this to you?

Nice to have

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions