Description
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
- Open Zed's built-in terminal
- Start Claude Code (claude code)
- Type some text and press Shift+Enter
- Expected: New line is created
- 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