claude-code - 💡(How to fix) Fix [BUG] Multi-line paste still loses newlines in cmux + tmux (different root cause from #43167) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#51667Fetched 2026-04-22 07:56:07
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Error Message

Error Messages/Logs

RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

What's Wrong?

Multi-line paste collapses to one line in Claude Code's prompt when running inside cmux + tmux. The fix shipped for #43167 (which addressed tmux's extended-keys-format csi-u re-encoding CR inside bracketed paste) does not cover this case — for me, tmux is not re-encoding anything. Bytes arrive at the application cleanly with \n separators intact, and Claude Code drops the newlines anyway.

The same Claude Code 2.1.112 build, same tmux config, same pasted content, in the VSCode integrated terminal preserves the newlines. So the trigger is something cmux-specific that happens above the tmux layer (probably a terminal capability reply, e.g. kitty keyboard protocol negotiation, that branches Claude's paste tokenizer).

What Should Happen?

Pasted multi-line text should preserve line breaks in Claude Code's prompt, as it does in:

  • A plain shell pane in the same tmux session in cmux (newlines preserved)
  • Claude Code 2.1.112 in the VSCode integrated terminal + same tmux config (newlines preserved)

Error Messages/Logs

Steps to Reproduce

  1. Open cmux (desktop terminal app), launch tmux 3.5a inside it, launch claude.
  2. Copy a 3-line block to the clipboard, e.g. LINE-A LINE-B LINE-C
  3. Paste into Claude's prompt → text appears as one line: LINE-A LINE-B LINE-C.

Control test (proves terminal stack delivers clean bytes):

 In a plain shell pane in the same tmux session, run:
     printf '\e[?2004h' && cat | od -c; printf '\e[?2004l'
 Paste the same 3-line block, press Ctrl+D. Output (abridged):
     033 [ 2 0 0 ~ L I N E - A \n L I N E - B \n L I N E - C 033 [ 2 0 1 ~
 Bracketed-paste markers present, `\n` separators intact. tmux is not re-encoding CR here.

Toggling the tmux options that fixed #43167 has zero effect: tmux set -s extended-keys off tmux set -as terminal-features 'xterm*' Claude Code still collapses pastes; shell paste in the same pane still preserves newlines.

Outer terminal that triggers the bug: cmux Outer terminal that does NOT trigger the bug: VSCode integrated terminal (same Claude version, same tmux) Multiplexer: tmux 3.5a OS: macOS 24.6.0 Env inside tmux (identical in both terminals): TERM=tmux-256color, TERM_PROGRAM=tmux, COLORTERM=truecolor

Related:

  • #43167 — Multi-line paste loses newlines when tmux extended-keys-format is csi-u (closed COMPLETED 2026-04-03)
  • #43169 — Same symptom, locked duplicate of #43167

Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.116

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

No response

extent analysis

TL;DR

The issue can be worked around by investigating and potentially modifying the terminal capability replies or keyboard protocol negotiations between cmux and Claude Code.

Guidance

  • Investigate the differences in terminal capability replies or keyboard protocol negotiations between cmux and the VSCode integrated terminal to identify the trigger for the newline collapse.
  • Verify that the issue is specific to cmux by testing with other terminal emulators and comparing the results.
  • Check the Claude Code documentation and source code for any settings or configurations related to terminal capabilities or keyboard protocols that could be adjusted to prevent the newline collapse.
  • Consider testing with different versions of tmux or cmux to see if the issue is specific to the current versions being used.

Example

No code snippet is provided as the issue seems to be related to terminal capabilities and keyboard protocols, which are not directly related to code.

Notes

The issue seems to be specific to the combination of cmux, tmux, and Claude Code, and may be related to the way terminal capabilities or keyboard protocols are handled. Further investigation is needed to determine the root cause and find a solution.

Recommendation

Apply workaround: Investigate and modify terminal capability replies or keyboard protocol negotiations between cmux and Claude Code to prevent newline collapse, as the root cause is likely related to these interactions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING