Skip to content

Shift+Enter in built-in terminal sends same escape sequence as Enter, preventing newlines in Claude Code #33858

Closed
@taras-mrtn

Description

@taras-mrtn

Summary

Shift+Enter in built-in terminal sends same escape sequence as Enter, preventing newlines in Claude Code

Description

Problem

When using Claude Code in Zed's built-in terminal, pressing Shift+Enter executes the command instead of creating a newline. Another way to create a newline in Claude Code is to use '', but it is less convenient. Claude Code supports Shift+Enter.

Root Cause

In crates/terminal/src/mappings/keys.rs, both regular Enter and Shift+Enter are mapped to the same escape sequence (\x0d - carriage return):

("enter", AlacModifiers::None) => Some("\x0d"),
("enter", AlacModifiers::Shift) => Some("\x0d"),  // Same as regular enter

Expected Behavior

  • Enter: Execute command (send \x0d)
  • Shift+Enter: Create newline (send \x0a)

This follows standard terminal conventions where line feed (\x0a) creates a newline without executing.

Steps to Reproduce

  1. Open Zed's built-in terminal
  2. Start Claude Code (claude code)
  3. Type some text and press Shift+Enter
  4. Expected: New line is created
  5. Actual: Command is executed

Impact

This affects any terminal application that expects Shift+Enter to create newlines, particularly AI chat interfaces and multi-line input scenarios.

Note

If you believe this change will cause any issues, please feel free to close without merging.

Zed Version and System Specs

Zed 0.192.1
macOS 15.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions