Skip to content

fix(viewer): the span gutter moves to the right edge; any span's intent promotes to a comment - #35

Merged
folded merged 2 commits into
mainfrom
fix/span-gutter-right-edge
Sep 4, 2026
Merged

fix(viewer): the span gutter moves to the right edge; any span's intent promotes to a comment#35
folded merged 2 commits into
mainfrom
fix/span-gutter-right-edge

Conversation

@folded

@folded folded commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

The strip moves to the right edge

The centre gutter pushed the two code columns ~250px apart and broke the
side-by-side read. Line numbers stay on the left of each half — they are a
lookup target, and tracing a line to a number across whitespace is hard — so
the strip goes to the outside:

 12 │ old code        │ 12 │ new code        ▌ rationale

New half grid is lineno · code · bars · text, the strip sticky to the right
edge
— the plain mirror of the line numbers' sticky-left (right: 0 on the
text, right: var(--gutter-text-w) on the bars). Bar against the code;
innermost bar nearest the code (depth 0 against the text, each level 6px
nearer). The .diff split is untouched, so the code viewports stay equal:
424.406 / 424.422 at 1440px, 254.406 / 254.422 at 1100px. Scrolling the half
80px moves the code −80 and the strip 0.

Collapsed (g) is bars alone, flush with the half's edge; both code viewports
widen equally; no row stretches; hover, click, reload and panel as before.

Promote any span's intent

#34 retired the code-side note form and with it "Add as comment" on a span's
intent — which had only ever existed for single-line spans. Every block's pill
row now carries + comment, so multi-line spans get it for the first time.
Reuses the smell-pill path (promote({derivedFrom, …})); a promoted intent
lands as a comment on the span's first line.

Promoting a multi-line span hides its text block and keeps its bar — the
comment stands in for the text, but the bar marks a range the comment does not.
The single-line rule (dot goes too) is unchanged. Both sites that must agree do:
_attachSpans draws a promoted span's bar but no block, and the comment sweep
removes .span-text and dots only. openPromotionEditor and the editor's
prefillBody/derivedFrom were dead since #34 and are removed.

Mutations verified

Un-stick the strip (moves −80 with the code) · bars from the code side (depth 0
lands nearest the code) · drop both takeRecords() (page never settles — the
MO→pass→MO loop starves render; with the guard: 13 RO callbacks per toggle for
13 halves, 0 MO) · affordance on single-line blocks only (3 fail) · sweep
removes bars (2 fail).

Two things worth a follow-up, not widened into here

Comment boxes under the strip. .cell-annotation spans every column, so in a
hunk whose lines overflow the viewport a 64ch comment box runs under the sticky
strip. Confined the new half's annotation cell to grid-column: 1 / 3 so boxes
wrap before the strip whenever the row fits; a full fix caps .annot-box at the
visible code width (container-type: inline-size on .half).

The pill row costs a line on smell-less blocks — a span with no smells now
starts its intent one line below the bar's first row, because the + comment
button lives in that row. Alternative: float the button inside the intent when
there are no pills. Followed the brief's wording; flagging for the reviewer.

Pre-existing, noted: Render.renderHunkReplace (SSE hunk) swaps the hunk
DOM without Comments.renderAll(), so that hunk's threads vanish until the next
full render. Not introduced here.

Gate

414 vitest (410 → 414), 1051 Python unchanged, pyright 0, ruff clean.

The new half's grid is `lineno · code · bars · text`: line numbers stay
on the left of each half, the two code columns sit beside each other, and
the strip — bars against the code, rationale outside them — is sticky to
the half's right edge (`right` offsets, the mirror of the lineno's
`left: 0`). The `.diff` split is unchanged, so the code viewports stay
equal: 424.406 / 424.422 px at 1440, 254.406 / 254.422 at 1100. The
outermost bar is against the text and each level of nesting one column
nearer the code; the pseudo-item painting the strip's background through
annotation rows spans the strip's two columns and sticks right. The
annotation cell takes only the number and code columns, so a comment box
wraps before the strip. The gutter cells follow column order in the DOM
(bars, then text); `children[1]` stays the content cell.

Folded, the gutter is the bars alone at the right edge. The placement
pass is unchanged.
Every span block's pill row — the row that leads it with its smell pills
— ends with a `+ comment` affordance that promotes the span's intent by
the one-click path the pills use (`Comments.promote`, the generalised
`promoteSmell`): a local comment on the span's first line, `derived_from`
the span's id. Multi-line spans gain it for the first time; "Add as
comment" had only ever existed on the retired code-side note form, and
the editor-prefill path that served it goes with it.

A promoted span loses its text block and, on one line, its dot — the
comment stands in their place — but keeps its bar, which marks a range
the comment does not; the renderer and the comment sweep agree on this,
and a half whose only spans are promoted bars still runs the placement
pass so the bar crosses the thread row.
@folded
folded merged commit c3424e2 into main Sep 4, 2026
5 checks passed
@folded
folded deleted the fix/span-gutter-right-edge branch September 4, 2026 05:29
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