claude-code - 💡(How to fix) Fix [BUG] Fullscreen TUI mode doesn't normalize \r\n on paste — ^M characters and doubled blank lines [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#52164Fetched 2026-04-23 07:34:56
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×4closed ×1commented ×1

When fullscreen TUI mode is active (/tui fullscreen), pasting content with \r\n line endings produces two different symptoms:

  1. ^M characters — pasting terminal output that includes \r (e.g. p10k/Powerlevel10k prompt lines, content pasted via Ghostty's "dangerous paste" confirmation dialog)
  2. Extra blank lines — pasting from sources with \r\n line endings (e.g. Xcode console output) produces a blank line between every content line

Root Cause

When fullscreen TUI mode is active (/tui fullscreen), pasting content with \r\n line endings produces two different symptoms:

  1. ^M characters — pasting terminal output that includes \r (e.g. p10k/Powerlevel10k prompt lines, content pasted via Ghostty's "dangerous paste" confirmation dialog)
  2. Extra blank lines — pasting from sources with \r\n line endings (e.g. Xcode console output) produces a blank line between every content line

Fix Action

Workaround

Disable fullscreen TUI, or clean clipboard before pasting: pbpaste | tr -d '\r' | pbcopy

RAW_BUFFERClick to expand / collapse

Claude Code version: 2.1.117 OS: macOS Terminal: Ghostty 1.3.1

Description

When fullscreen TUI mode is active (/tui fullscreen), pasting content with \r\n line endings produces two different symptoms:

  1. ^M characters — pasting terminal output that includes \r (e.g. p10k/Powerlevel10k prompt lines, content pasted via Ghostty's "dangerous paste" confirmation dialog)
  2. Extra blank lines — pasting from sources with \r\n line endings (e.g. Xcode console output) produces a blank line between every content line

Steps to reproduce

  1. Enable fullscreen TUI: /tui fullscreen
  2. Copy any of the following and paste into the input:
    • Terminal output that includes a p10k prompt line
    • Output from Xcode's console
  3. Observe ^M or doubled blank lines in the pasted content (visible via Ctrl+G editor)

Expected behaviour

\r\n normalized to \n on paste, as it is in standard (non-fullscreen) mode.

Workaround

Disable fullscreen TUI, or clean clipboard before pasting: pbpaste | tr -d '\r' | pbcopy

Notes

  • Standard (non-fullscreen) mode handles paste correctly — this is a fullscreen TUI-specific regression
  • Also reproducible via Ctrl+G editor which shows raw ^M characters throughout pasted content
  • Related: #22385 (closed duplicate — same doubled blank lines symptom, different environment)

extent analysis

TL;DR

The issue can be worked around by disabling fullscreen TUI mode or cleaning the clipboard content to remove \r characters before pasting.

Guidance

  • The problem seems to be related to how the fullscreen TUI mode handles \r\n line endings, which are not normalized to \n as expected.
  • To verify the issue, follow the provided steps to reproduce and observe the ^M characters or extra blank lines in the pasted content.
  • A temporary workaround is to use the provided command pbpaste | tr -d '\r' | pbcopy to clean the clipboard content before pasting.
  • The issue is specific to fullscreen TUI mode, and standard mode handles paste correctly, suggesting a regression in the fullscreen TUI implementation.

Example

No code snippet is provided as the issue does not require a code change, but rather a configuration or workaround.

Notes

The provided workaround is a temporary solution, and a proper fix would involve modifying the fullscreen TUI mode to correctly handle \r\n line endings. The issue is also related to a previously closed duplicate (#22385), which had the same symptom but in a different environment.

Recommendation

Apply the workaround by disabling fullscreen TUI mode or using the pbpaste | tr -d '\r' | pbcopy command to clean the clipboard content before pasting, as this is the most straightforward way to mitigate the issue until a proper fix is available.

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

claude-code - 💡(How to fix) Fix [BUG] Fullscreen TUI mode doesn't normalize \r\n on paste — ^M characters and doubled blank lines [1 comments, 2 participants]