Skip to content

feat(tui): give the answer the width of the pane - #421

Merged
mohitranka merged 5 commits into
mainfrom
feat/answer-layout
Aug 22, 2026
Merged

mohitranka merged 5 commits into
mainfrom
feat/answer-layout

Conversation

@mohitranka

@mohitranka mohitranka commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Five fixes to how an answer sits in the pane, from two screenshots of long
replies in a wide window.

The measure

The answer wrapped at 72 columns whatever the pane was, so a ~200-column
window left roughly two thirds of it empty while the text wrapped every few
words — and the rule under an H1 stopped at 72 too, reading as a fragment
floating in a void. Prose now takes the pane less a constant two-column
gutter.

Most of an agent's answer is list items of ten to twenty-five words. At 72
columns each wrapped to three lines; given the room each is a single line,
which also stops successive items blurring together. The gutter is fixed
rather than a share of the width, so the margin reads the same at every size.
Narrow panes are unaffected — there the pane was always the limit and the cap
never bound.

The cards do not follow prose to full width. PROSE_MAX_WIDTH became
CARD_MAX_WIDTH and now bounds only the approval, question, home and plan
cards, which are mostly short labels and a command: a three-word command
inside a two-hundred-column border reads as a mistake. That is a bound on box
size, not a reading measure.

Headings and edges

A second-level heading is marked in the margin. H1 is told apart by its
rule; H2 had only bold, which in a monospace face at terminal sizes is nearly
no signal — every section heading read as another paragraph. H2 now carries a
bar: ornament rather than more weight, so rank still reads without spending
hue, which theme::heading reserves for brand.

The collapsed reasoning line shares the answer's left edge. It used the
deeper indent that expanded reasoning uses to subordinate itself to the answer
around it. On a single line above the answer that subordinates nothing, and
just started the reply on a different left edge from everything under it.
Expanded reasoning keeps the deeper indent, where it means something.

Code blocks

A block closes with a gap. It opened with air above and closed with none,
so the next paragraph started on the row directly under the last line of code.
Unlike a heading — which belongs to what follows it, and is correctly kept
tight to it — a fenced block belongs to itself.

And it no longer sits on a filled ground. The rail and the syntax colours
already say a block is code; the tint said it again with a slab the width of
the pane, and grew when prose stopped capping at 72.

Three separate places painted that ground, which took two passes to clear:
code_row styled the whole line, the transcript's CodeBlock arm re-styled
every line on top of what render_markdown had already produced, and
render_highlighted_line set a background on each syntax token's span. The
last one is why the block looked ragged rather than merely tinted — the tint
ended wherever a token ended, and blank lines inside a block had no tokens at
all. Rows are no longer padded to the pane either; that padding existed only
to carry the tint to the right edge.

Inline code chips and the approval card's command line keep theirs. A single
token in a sentence has no rail and no syntax colouring, so the chip is the
only thing marking it.

Three faults from the same study that are not here

The first screenshot suggested six problems. Probing the renderer killed three:

  • Inline code chips bleeding onto wrapped prose. Backgrounds sat only on
    the code tokens; the tint on "themes." was a compression artifact.
  • Bullet continuation sitting under the marker. The continuation prefix is
    already indent + marker_w, so wrapped text aligns under text.
  • A heading colliding with the list above it. render_markdown emits a
    blank before a heading and none after, which is the correct relationship.

The third is not fully settled: the screenshot really does show a section
label jammed against the bullet above it, and that construct evidently was not
a markdown heading — most likely a bold paragraph or a lazy continuation. If
so forge is arguably still at fault, since the reader cannot tell the
difference, but that wants the raw answer text to confirm and is not in this
PR.

Verification

Driven in a real tmux PTY at 200x45 and 150x40 against a live provider, and
the tint removal was confirmed visually by the author before commit. Every
commit ships tests. cargo fmt, cargo clippy --all-targets (zero warnings)
and cargo test --workspace (zero failures) are green.

https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM

H1 is told apart by the rule under it. H2 had only bold, and in a monospace
face at terminal sizes bold against regular is nearly no signal — in a
structured answer, every section heading read as another paragraph.

H2 now carries a bar in the margin. Ornament rather than more weight, so rank
still reads without spending hue, which theme::heading reserves for brand. The
bar goes through the paragraph prefix, which wrap_spans already styles muted
and already aligns continuation lines under the text.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM
The measure was 72 columns whatever the pane was. In a 200-column window that
left roughly two thirds of it empty while the text wrapped every few words,
and the rule under an H1 stopped at 72 too, so it read as a fragment floating
in a void rather than as a deliberate column.

Prose now takes the pane less a constant two-column gutter. Most of an agent's
answer is list items of ten to twenty-five words: at 72 columns each wrapped to
three lines, and given the room each is a single line — which also stops
successive items blurring into one another. A fixed gutter rather than a share
of the width, so the margin reads the same at every size instead of growing
into leftover space. Narrow panes are unaffected: there the pane was always the
limit and the cap never bound.

The cards do not follow it there. PROSE_MAX_WIDTH became CARD_MAX_WIDTH and now
applies only to the approval, question, home and plan cards, which are mostly
short labels and a command — a three-word command inside a two-hundred-column
border reads as a mistake. That is a bound on box size, not a reading measure.

Also aligns the collapsed reasoning line with the answer. It used the deeper
indent that expanded reasoning uses to subordinate itself to the answer around
it; on a single line above the answer that subordinates nothing, and just
started the reply on a different left edge from everything under it.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM
A block opened with air above it and closed with none, so the next paragraph
started on the row directly under the last line of code, against a tinted slab
it has nothing to do with.

Unlike a heading — which belongs to what follows it, and is correctly kept
tight to it — a fenced block belongs to itself. It now emits a trailing blank.
One, not two: a following heading only adds its own when the last line is not
already blank.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM
The rail and the syntax colours already say a block is code. The tint added a
slab of paint the width of the pane to say it again, and widened along with it
when prose stopped capping at 72 columns.

Rows are no longer padded to the pane either — that padding existed only to
carry the tint to the right edge, and without it the trailing spaces were just
trailing spaces.

This also settles a reported inconsistency where the last line of a block
looked untinted: every row did in fact carry it (the colour came from the
Line's base style, not the spans), so the odd row was a viewport edge. With no
tint there is nothing left to be inconsistent about.

Inline code chips keep their tint: a token inside a sentence has no rail and
no colouring to mark it, so the chip is the only thing distinguishing it.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM
Dropping the tint from code_row covered one of three places that painted a
ground on a code block. Two were left, and together they were the ones on
screen:

The transcript's own CodeBlock arm re-styled every line render_markdown had
already produced, painting a second ground over the finished block. And
render_highlighted_line set a background on each syntax token's span, so the
tint ended wherever a token ended and blank lines inside a block — having no
tokens — stayed dark.

That per-token ground is why the block looked ragged rather than merely
tinted, and the previous commit made it worse: removing the row padding took
away the thing that had been filling each row out to the pane edge, turning a
rectangle into a torn shape. Verified this time by dumping every line and
every span across code rows, blank rows inside the block, and the prose after
it — no background anywhere.

Inline code chips and the approval card's command line keep theirs: a single
token in a sentence has no rail and no syntax colouring, so the chip is the
only thing marking it.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM
@mohitranka
mohitranka merged commit 8ff8199 into main Aug 22, 2026
7 checks passed
@mohitranka
mohitranka deleted the feat/answer-layout branch August 22, 2026 02:48
mohitranka added a commit that referenced this pull request Sep 11, 2026
* feat(tui): mark a second-level heading in the margin

H1 is told apart by the rule under it. H2 had only bold, and in a monospace
face at terminal sizes bold against regular is nearly no signal — in a
structured answer, every section heading read as another paragraph.

H2 now carries a bar in the margin. Ornament rather than more weight, so rank
still reads without spending hue, which theme::heading reserves for brand. The
bar goes through the paragraph prefix, which wrap_spans already styles muted
and already aligns continuation lines under the text.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM

* feat(tui): give the answer the width of the pane

The measure was 72 columns whatever the pane was. In a 200-column window that
left roughly two thirds of it empty while the text wrapped every few words,
and the rule under an H1 stopped at 72 too, so it read as a fragment floating
in a void rather than as a deliberate column.

Prose now takes the pane less a constant two-column gutter. Most of an agent's
answer is list items of ten to twenty-five words: at 72 columns each wrapped to
three lines, and given the room each is a single line — which also stops
successive items blurring into one another. A fixed gutter rather than a share
of the width, so the margin reads the same at every size instead of growing
into leftover space. Narrow panes are unaffected: there the pane was always the
limit and the cap never bound.

The cards do not follow it there. PROSE_MAX_WIDTH became CARD_MAX_WIDTH and now
applies only to the approval, question, home and plan cards, which are mostly
short labels and a command — a three-word command inside a two-hundred-column
border reads as a mistake. That is a bound on box size, not a reading measure.

Also aligns the collapsed reasoning line with the answer. It used the deeper
indent that expanded reasoning uses to subordinate itself to the answer around
it; on a single line above the answer that subordinates nothing, and just
started the reply on a different left edge from everything under it.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM

* fix(tui): close a fenced code block with a gap

A block opened with air above it and closed with none, so the next paragraph
started on the row directly under the last line of code, against a tinted slab
it has nothing to do with.

Unlike a heading — which belongs to what follows it, and is correctly kept
tight to it — a fenced block belongs to itself. It now emits a trailing blank.
One, not two: a following heading only adds its own when the last line is not
already blank.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM

* fix(tui): drop the filled ground behind a code block

The rail and the syntax colours already say a block is code. The tint added a
slab of paint the width of the pane to say it again, and widened along with it
when prose stopped capping at 72 columns.

Rows are no longer padded to the pane either — that padding existed only to
carry the tint to the right edge, and without it the trailing spaces were just
trailing spaces.

This also settles a reported inconsistency where the last line of a block
looked untinted: every row did in fact carry it (the colour came from the
Line's base style, not the spans), so the odd row was a viewport edge. With no
tint there is nothing left to be inconsistent about.

Inline code chips keep their tint: a token inside a sentence has no rail and
no colouring to mark it, so the chip is the only thing distinguishing it.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM

* fix(tui): remove the last two grounds painted behind code

Dropping the tint from code_row covered one of three places that painted a
ground on a code block. Two were left, and together they were the ones on
screen:

The transcript's own CodeBlock arm re-styled every line render_markdown had
already produced, painting a second ground over the finished block. And
render_highlighted_line set a background on each syntax token's span, so the
tint ended wherever a token ended and blank lines inside a block — having no
tokens — stayed dark.

That per-token ground is why the block looked ragged rather than merely
tinted, and the previous commit made it worse: removing the row padding took
away the thing that had been filling each row out to the pane edge, turning a
rectangle into a torn shape. Verified this time by dumping every line and
every span across code rows, blank rows inside the block, and the prose after
it — no background anywhere.

Inline code chips and the approval card's command line keep theirs: a single
token in a sentence has no rail and no syntax colouring, so the chip is the
only thing marking it.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM
mohitranka added a commit that referenced this pull request Sep 11, 2026
* feat(tui): mark a second-level heading in the margin

H1 is told apart by the rule under it. H2 had only bold, and in a monospace
face at terminal sizes bold against regular is nearly no signal — in a
structured answer, every section heading read as another paragraph.

H2 now carries a bar in the margin. Ornament rather than more weight, so rank
still reads without spending hue, which theme::heading reserves for brand. The
bar goes through the paragraph prefix, which wrap_spans already styles muted
and already aligns continuation lines under the text.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM

* feat(tui): give the answer the width of the pane

The measure was 72 columns whatever the pane was. In a 200-column window that
left roughly two thirds of it empty while the text wrapped every few words,
and the rule under an H1 stopped at 72 too, so it read as a fragment floating
in a void rather than as a deliberate column.

Prose now takes the pane less a constant two-column gutter. Most of an agent's
answer is list items of ten to twenty-five words: at 72 columns each wrapped to
three lines, and given the room each is a single line — which also stops
successive items blurring into one another. A fixed gutter rather than a share
of the width, so the margin reads the same at every size instead of growing
into leftover space. Narrow panes are unaffected: there the pane was always the
limit and the cap never bound.

The cards do not follow it there. PROSE_MAX_WIDTH became CARD_MAX_WIDTH and now
applies only to the approval, question, home and plan cards, which are mostly
short labels and a command — a three-word command inside a two-hundred-column
border reads as a mistake. That is a bound on box size, not a reading measure.

Also aligns the collapsed reasoning line with the answer. It used the deeper
indent that expanded reasoning uses to subordinate itself to the answer around
it; on a single line above the answer that subordinates nothing, and just
started the reply on a different left edge from everything under it.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM

* fix(tui): close a fenced code block with a gap

A block opened with air above it and closed with none, so the next paragraph
started on the row directly under the last line of code, against a tinted slab
it has nothing to do with.

Unlike a heading — which belongs to what follows it, and is correctly kept
tight to it — a fenced block belongs to itself. It now emits a trailing blank.
One, not two: a following heading only adds its own when the last line is not
already blank.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM

* fix(tui): drop the filled ground behind a code block

The rail and the syntax colours already say a block is code. The tint added a
slab of paint the width of the pane to say it again, and widened along with it
when prose stopped capping at 72 columns.

Rows are no longer padded to the pane either — that padding existed only to
carry the tint to the right edge, and without it the trailing spaces were just
trailing spaces.

This also settles a reported inconsistency where the last line of a block
looked untinted: every row did in fact carry it (the colour came from the
Line's base style, not the spans), so the odd row was a viewport edge. With no
tint there is nothing left to be inconsistent about.

Inline code chips keep their tint: a token inside a sentence has no rail and
no colouring to mark it, so the chip is the only thing distinguishing it.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM

* fix(tui): remove the last two grounds painted behind code

Dropping the tint from code_row covered one of three places that painted a
ground on a code block. Two were left, and together they were the ones on
screen:

The transcript's own CodeBlock arm re-styled every line render_markdown had
already produced, painting a second ground over the finished block. And
render_highlighted_line set a background on each syntax token's span, so the
tint ended wherever a token ended and blank lines inside a block — having no
tokens — stayed dark.

That per-token ground is why the block looked ragged rather than merely
tinted, and the previous commit made it worse: removing the row padding took
away the thing that had been filling each row out to the pane edge, turning a
rectangle into a torn shape. Verified this time by dumping every line and
every span across code rows, blank rows inside the block, and the prose after
it — no background anywhere.

Inline code chips and the approval card's command line keep theirs: a single
token in a sentence has no rail and no syntax colouring, so the chip is the
only thing marking it.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM
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.

1 participant