Skip to content

Copy editor: rewrap inside quotes, writing each level as Markdown's > - #1466

Merged
nedtwigg merged 4 commits into
mainfrom
issue-22-rewrap-quotes
Oct 31, 2026
Merged

nedtwigg merged 4 commits into
mainfrom
issue-22-rewrap-quotes

Conversation

@nedtwigg

@nedtwigg nedtwigg commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Claude Code draws a Markdown quote with a quote bar (U+258E) on every row, nested quotes as one bar per level. The bar sits in Block Elements, so the copy editor read it as box-drawing decoration: a single level was stripped, pasting the quote as unquoted prose, and the inner bar of a nested quote was text that landed mid-sentence once Auto joined its rows. A hard-wrapped Markdown > quote had the same flaw from the other side: nothing marked the prefix, so joining its rows left a > b behind.

A quote prefix is now its own fact of a logical line: one marker per level, with text after it — a >, or a quote bar at most two spaces from its text. Auto keeps a break where depth changes and judges the rest of a quoted line as if unquoted; every format writes a bar as > and drops a prefix with the break deleted before it, so Spaces and per-break overrides follow the same rule. Paragraph scope starts a quoted paragraph at its prefix.

The same ▎ is the default indent guide of Neovim's indent-blankline, drawn at every indent stop and on blank lines. A guide at a shiftwidth of 3 or more sits further from its text than Claude Code's bar, so it stays indentation; a line of bars alone is a blank line, written between quoted lines with the shallower one's prefix so a quote's paragraphs stay apart; and a leading run of guides is now blanked whole, where before only the first was, so nested guided code pastes with its full indent. At shiftwidth 2 guides still read as quote bars (recorded in the rationale).

The issue's sample also kept two breaks for a second reason: a wrapper that keeps the space it broke at (wrap-ansi with trim: false) carries it onto the row after a full one, which then sits one column deeper than its hanging indent, and the row after that one column shallower. Auto now joins both.

Merge before #1475 (#85), which conflicts in copy-text.ts and mouse-and-clipboard.md and gets rebased after this lands.

Fixes #22

🤖 Generated with Claude Code

Claude Code draws a Markdown quote with a quote bar (U+258E) on every row,
nested quotes as one bar per level. The bar sits in Block Elements, so the
copy editor read it as box-drawing decoration: a single level was stripped,
pasting the quote as unquoted prose, and the inner bar of a nested quote was
text that landed mid-sentence once Auto joined its rows. A hard-wrapped
Markdown `>` quote had the same flaw from the other side: nothing marked the
prefix, so joining its rows left `a > b` behind.

A quote prefix is now its own fact of a logical line: one marker per level,
`>` or a quote bar, before text. Auto keeps a break where depth changes and
judges the rest of a quoted line as if unquoted; every format writes a bar
as `>` and drops a prefix with the break deleted before it, so Spaces and
per-break overrides follow the same rule. An empty bar line is a blank line
inside the quote, not a frame; a lone `>` stays text (an empty prompt).
Paragraph scope starts a quoted paragraph at its prefix.

The issue's sample also kept two breaks for a second reason: a wrapper that
keeps the space it broke at (wrap-ansi with trim: false) carries it onto the
row after a full one, which then sits one column deeper than its hanging
indent, and the row after that one column shallower. Auto now joins both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4686a1c
Status: ✅  Deploy successful!
Preview URL: https://87c66851.mouseterm.pages.dev
Branch Preview URL: https://issue-22-rewrap-quotes.mouseterm.pages.dev

View logs

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One open question about which ▎ lines count as quotes; see the inline comment.

Comment thread lib/src/lib/copy-text.ts Resolved
Neovim's indent-blankline draws `▎`, the bar Claude Code quotes with, at
every indent stop and on blank lines inside a block. Any bar before text
was a quote, so a guided code line pasted as `> > print(x)` with its
indent gone, and a guide alone on a blank line became an empty `>` line.

The two differ in spacing: Claude Code writes its bar one space from its
text (two where a wrap carried a space), and a guide at a shiftwidth of 3
or more sits further. A quote bar is now at most two spaces from text that
is no other marker, and a prefix needs text after it, so a lone bar is
decoration again. A leading run of wider guides is now blanked whole, where
before only the first was, leaving the inner guides of nested code in the
paste. At shiftwidth 2 guides still read as quote bars; the rationale
records the trade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines that hold only a bar are now dropped, not kept blank, so a Claude Code quote with more than one paragraph pastes as a single paragraph; see the inline comment.

Comment thread lib/src/lib/copy-text.ts Resolved
Round 1 made a line of bars alone frame-only, so it was dropped: a Claude
Code quote of several paragraphs pasted as one Markdown paragraph, and code
under Neovim's indent guides lost its blank lines. Such a line is either a
quote's paragraph break or a guide on a blank code line; its neighbors tell
which. It is now blank (and a paragraph boundary), and between two quoted
lines it is written with the shallower one's prefix, so the quote goes on
past it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every blank line between two quoted lines now gets a quote prefix, including an empty row that has no bar on it, so two separate quotes paste as one; see the inline comment.

Comment thread lib/src/lib/copy-text.ts Resolved
Round 2 wrote the shallower quote prefix onto every blank line between two
quoted lines, but a truly empty row is blank too, so two quotes an empty row
separates (a Markdown file or email shown with `cat`, or two Claude Code
quotes) pasted as one. Only a row of bars alone is now written as a quote
line, as the spec already says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nedtwigg
nedtwigg marked this pull request as ready for review October 31, 2026 05:27
@nedtwigg
nedtwigg merged commit d6ac881 into main Oct 31, 2026
19 checks passed
@nedtwigg
nedtwigg deleted the issue-22-rewrap-quotes branch October 31, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copy rewrapped should handle with nested quotes

2 participants