[BUG] Pasting text with trailing newline auto-submits prompt (iTerm2, macOS)

Resolved 💬 4 comments Opened Mar 30, 2026 by william-davies Closed May 4, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When pasting text that ends with a newline character into the Claude Code prompt in iTerm2, the prompt is automatically submitted — as if Enter was pressed. I'm experiencing this frequently when copying from PyCharm.

What Should Happen?

Pasted newlines should not trigger submission. Terminals like iTerm2 support bracketed paste mode, which wraps pasted content in escape sequences (\e[200~ ... \e[201~) so applications can distinguish pasted input from typed input. Claude Code should honor this to prevent accidental submission.

Error Messages/Logs

Steps to Reproduce

  1. Copy any text that ends with a newline. The scenario I face is double clicking a line of a file in PyCharm to select the entire line, including the newline at the end.
  2. Paste into the Claude Code prompt
  3. Prompt submits immediately without pressing Enter

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.87

Platform

AWS Bedrock

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

_No response_

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗