[FEATURE] Add a flag that tells Claude Code to emit long lines for prose/markdown content and let the terminal emulator handle word wrapping, rather than inserting hard newline characters at word boundaries

Status Open
Maintainer reply None cached
Activity 15 comments · opened Apr 3, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Problem
Claude Code uses Ink's word wrapping to insert \n characters at word boundaries based on process.stdout.columns. These hard newlines are written into the terminal's scrollback buffer and are indistinguishable from intentional paragraph breaks.

This creates a permanent problem for terminal emulators that support reflow:
Terminal emulators track two types of line endings: soft wraps (line exceeded column width — flagged with WRAPLINE) and hard wraps (explicit \n from the application)
On resize, soft wraps are reflowed to the new width automatically. Hard wraps are preserved as intentional
Because Claude Code inserts \n for word wrapping, all its output is treated as hard-wrapped and can never be reflowed

Real-world impact
In any terminal that allows pane resizing (tmux, Zellij, iTerm2 split panes, Windows Terminal panes, and custom Tauri-based terminals):
User opens a Claude Code session in a narrow pane (45 columns)
Claude Code renders conversation with word wrapping at 45 chars — inserting \n at every word boundary
User resizes the pane to 130 columns
Terminal sends SIGWINCH — Claude Code re-renders its current screen (prompt, status bar) at 130 cols
All scrollback content remains permanently wrapped at 45 characters with vast empty space on the right
The only fix is to restart the session with --resume, which is slow and disruptive

This is especially painful for --resume sessions, where the entire conversation history is rendered at whatever width the terminal happened to be at launch time.

Proposed Solution

Proposed solution
A mode where Claude Code outputs prose as long unwrapped lines, letting the terminal handle visual wrapping:

claude --no-word-wrap
# or
CLAUDE_NO_WRAP=1 claude

Only paragraph word wrapping changes. Structural line breaks (list items, headings, code fences, blank lines) remain as explicit \n.

Why this works
The terminal emulator soft-wraps long lines and flags them with WRAPLINE
On resize, soft-wrapped lines are automatically reflowed to the new width
Cursor positioning, status bars, and structured content still use process.stdout.columns for layout — unaffected
Existing behavior is the default — --no-word-wrap is opt-in

Affected environments
Terminal emulators with reflow: alacritty, kitty, WezTerm, Windows Terminal, iTerm2
Terminal multiplexers: tmux, Zellij
Custom embeddings: Tauri + alacritty_terminal, Electron-based terminals

Alternative Solutions

Alternatives considered
Restart with --resume on resize — Works but takes 1-2s and is disruptive. Currently our only workaround.
Fake large terminal width — Breaks status bar positioning, diff formatting, and all cursor-positioned content.
Heuristic reflow in the terminal emulator — Guess which \n are word-wrap vs intentional. Fragile, breaks on code/structured content.
Post-hoc scrollback rewriting — Scan scrollback, join lines near old column width, re-wrap. Complex, error-prone, destroys ANSI formatting boundaries.

None are satisfactory. The correct fix is for the content producer to distinguish structural newlines from word-wrap newlines, and only emit the former when the terminal can handle wrapping.

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

Affected environments
Terminal emulators with reflow: alacritty, kitty, WezTerm, Windows Terminal, iTerm2
Terminal multiplexers: tmux, Zellij
Custom embeddings: Tauri + alacritty_terminal, Electron-based terminals

Additional Context

_No response_

View original on GitHub ↗

11 Comments

github-actions[bot] · 4 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/42296
  2. https://github.com/anthropics/claude-code/issues/35905
  3. https://github.com/anthropics/claude-code/issues/8276

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

ahulce · 4 months ago

yes yes yes

j-256 · 4 months ago
The only fix is to restart the session with --resume, which is slow and disruptive This is especially painful for --resume sessions, where the entire conversation history is rendered at whatever width the terminal happened to be at launch time.

So is --resume a fix or a problem?
Edit: Ignore me, I think I misunderstood what you're saying.

jfdube · 4 months ago
> The only fix is to restart the session with --resume, which is slow and disruptive > This is especially painful for --resume sessions, where the entire conversation history is rendered at whatever width the terminal happened to be at launch time. So is --resume a fix or a problem?

Neither, it's a workaround. The real solution is that Claude avoids inserting newlines into the text stream and let the terminal handle word wraps, making reflow possible.

plantegg · 4 months ago

+1 on this. Concrete repro and workaround results from today on macOS + iTerm2:

Setup: Claude Code CLI in iTerm2, standard 80-ish column window.

Problem: Copying any multi-line prose output from the terminal and pasting elsewhere produces a newline at every visual line break. cat -ve on the clipboard confirms real $ (i.e. \n) at those positions, so the wrapping is hard, not a terminal soft-wrap.

Workarounds tried:

  • COLUMNS=9999 claudeno effect. Claude Code appears to read terminal width via ioctl(TIOCGWINSZ) directly and ignores the env var.
  • stty cols 9999 && claude — works for output width, but makes the interactive prompt unusable (cursor jumps past the physical window edge).
  • claude -p "…" | pbcopy — works cleanly, output has no hard wraps. Not viable for interactive sessions though.

Ask: a settings.json key (e.g. wrapOutput: false) or a CLI flag (--no-wrap) that leaves prose/markdown unwrapped and lets the terminal emulator do soft-wrapping. Code blocks can keep their current behavior.

The -p pipe result proves the non-wrapped path already exists internally — surfacing it as a user-facing toggle would unblock the copy-paste workflow without a rewrite.

dataders · 3 months ago

Reproduces in tmux on pane resize — also breaks URL highlighting

Hitting this in tmux (macOS). The two concrete pain points:

1. Word wrap breaks on pane resize

  • Open Claude Code in a tmux pane at any width
  • Resize the pane (drag, or use a layout command like prefix + {)
  • Scrollback content stays hard-wrapped at the original column width — vast empty space on the right, or text spilling past the pane edge depending on direction
  • Only workaround: claude --resume in the resized pane to re-render at the new width

2. Wrapped URLs lose clickability

  • When a URL falls near a line boundary, the hard \n splits it mid-URL
  • Terminal hyperlink detection only picks up one fragment — the clickable highlight covers only part of the URL
  • Repros consistently with any long URL (e.g. GitHub issue links) in a narrow-ish pane

Both issues share the root cause described here. The --no-word-wrap / OSC 8 approach would fix both.

KinRyuuu · 3 months ago

I'm trying to run claude within tmux windows - this would be a huge quality of life improvement

sourcehawk · 3 months ago

Yes please this is so annoying... Claude is linebreaking all markdown content when it writes it, including github issues and pr descriptions

FrannRod · 2 months ago

Strong +1, and I want to add an angle that I think is underrepresented in the related threads (most of them focus on the TUI render / copy-paste from stdout): the same hard-wrapping habit also leaks into the content Claude writes to disk and to git — commit message bodies, PR descriptions, .md/.txt files, docstrings and long code comments. Those get persisted with hard \n at ~72/80 columns and then look broken forever in any soft-wrapping viewer (git GUIs, GitHub's web UI, modern editors) — sentences chopped mid-line, sometimes mid-word.

This is arguably worse than the terminal-reflow case because it's not just a display artifact you can re---resume away: it's baked into the committed artifact. A teammate reviewing the commit in a GUI sees the mangled wrapping permanently.

The current workaround is a CLAUDE.md instruction telling the model to never hard-wrap prose, which helps but is fragile — it's a deeply ingrained generation habit, so it regresses in long sessions and isn't reliable enough to trust for commits.

So my ask is that whatever flag/behavior comes out of this (--no-word-wrap / CLAUDE_NO_WRAP=1) ideally cover both surfaces:

  1. TUI stdout (emit long lines, let the emulator soft-wrap — as described in the issue), and
  2. Generated file/commit/PR content (write one logical line per paragraph, blank line between paragraphs, preserve only structural newlines: lists, headings, table rows, code fences).

The structural-vs-arbitrary distinction the issue already draws is exactly right; it just needs to apply to written content too, not only the terminal.

adisidev · 1 month ago

for anyone who lands here, quick hack: press ctrl+o twice, it reloads the transcript for the current terminal size!

localparty · 1 month ago

**+1 — the hard newlines make Claude Code's prose hard to reuse for writing/drafting, which is a big part of why I use it.**

The problem isn't how the text looks in the terminal — it's what happens the moment I copy it out. Claude Code inserts a real \n at every wrap point, so one paragraph lands in my clipboard as a dozen hard-wrapped fragments:

Here is a paragraph Claude wrote. It's one logical thought,
but because the terminal happened to be ~60 columns wide when
it rendered, it now has four hard line breaks baked in that
were never part of the actual content.

Paste that into anything I draft in — a Markdown doc, a PR description, release notes, an Obsidian/iA Writer note — and I've imported four hardcoded breaks that don't belong. Now:

  • To edit a sentence in the middle, I have to manually rejoin the lines first.
  • The text won't reflow when the container width changes.
  • Diffs get noisy — a one-word change re-wraps and touches several lines.

Every serious writing/editing tool treats one paragraph = one line and lets the editor do the visual wrap. In VS Code that's Option+Z (Toggle Word Wrap); Obsidian, iA Writer, Typora — and Markdown itself — all work this way. It's basic editing ergonomics: you think and edit in sentences and paragraphs, not in visual line-fragments. Right now Claude Code is the one tool in the chain that bakes the visual wrap into the content, so it breaks that everywhere downstream.

Ask: an option to emit prose/Markdown as unwrapped logical lines (one line per paragraph) and let the terminal handle soft-wrapping — e.g. --no-word-wrap, a CLAUDE_NO_WRAP=1 env var, or the outputWrapping: "soft" config key proposed in #24224. Terminals (iTerm2, tmux, etc.) already soft-wrap long lines for display and omit the newline when you copy a soft-wrapped line — so the terminal view stays fine and the copied text is clean, reflowable Markdown.

This would make Claude Code's output directly reusable for drafting instead of something I have to de-wrap by hand every time.

Showing cached comments. Read the full discussion on GitHub ↗