fix(viewer): the span gutter moves to the right edge; any span's intent promotes to a comment - #35
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
New half grid is
lineno · code · bars · text, the strip sticky to the rightedge — the plain mirror of the line numbers' sticky-left (
right: 0on thetext,
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
.diffsplit 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 viewportswiden 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 intentlands 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:
_attachSpansdraws a promoted span's bar but no block, and the comment sweepremoves
.span-textand dots only.openPromotionEditorand the editor'sprefillBody/derivedFromwere 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 — theMO→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-annotationspans every column, so in ahunk 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 / 3so boxeswrap before the strip whenever the row fits; a full fix caps
.annot-boxat thevisible code width (
container-type: inline-sizeon.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
+ commentbutton 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(SSEhunk) swaps the hunkDOM without
Comments.renderAll(), so that hunk's threads vanish until the nextfull render. Not introduced here.
Gate
414 vitest (410 → 414), 1051 Python unchanged,
pyright0,ruffclean.