[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
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_
Showing cached comments. Read the full discussion on GitHub ↗
11 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
yes yes yes
So is
--resumea fix or a problem?Edit: Ignore me, I think I misunderstood what you're saying.
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.
+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 -veon the clipboard confirms real$(i.e.\n) at those positions, so the wrapping is hard, not a terminal soft-wrap.Workarounds tried:
COLUMNS=9999 claude— no effect. Claude Code appears to read terminal width viaioctl(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
-ppipe 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.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
prefix + {)claude --resumein the resized pane to re-render at the new width2. Wrapped URLs lose clickability
\nsplits it mid-URLBoth issues share the root cause described here. The
--no-word-wrap/ OSC 8 approach would fix both.I'm trying to run claude within tmux windows - this would be a huge quality of life improvement
Yes please this is so annoying... Claude is linebreaking all markdown content when it writes it, including github issues and pr descriptions
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/.txtfiles, docstrings and long code comments. Those get persisted with hard\nat ~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-
--resumeaway: 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.mdinstruction 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: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.
for anyone who lands here, quick hack: press ctrl+o twice, it reloads the transcript for the current terminal size!
**+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
\nat every wrap point, so one paragraph lands in my clipboard as a dozen hard-wrapped fragments: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:
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, aCLAUDE_NO_WRAP=1env var, or theoutputWrapping: "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.