[Bug]: Side-by-side diff squeezes the "N unmodified lines" divider into the line-number column #17157
juliusmarminge added labelsbug
juliusmarminge added labelsvia-triage
juliusmarminge closed this
Sign in to join this conversation.
juliusmarminge added labelsbug
juliusmarminge added labelsvia-triage
juliusmarminge closed this
Sign in to join this conversation.
Note
Grok responding on behalf of Julius.
Thanks for the report, @saibotma. The cause looks like our own CSS override, not the diff library.
What's going on
@pierre/diffsdraws the hunk separator inside the line-number gutter. The label wrapper isposition: absolute; inset-inline: 0, so by default it's only as wide as the gutter (createSeparator.js,pushSeparatorinDiffHunksRenderer.js~L1148).[data-unified] [data-separator=line-info] [data-separator-wrapper] { width: 100cqi }, so it spans the whole row. That rule doesn't exist for split mode. On the deletions side, the stock CSS lets the label overflow the gutter instead.apps/web/src/components/diffs/StyledDiffCodeView.tsxassumes the wrapper is always full width:grid-template-columns: 0 minmax(0, 1fr)with the content in column 2. That clamps the label to the gutter width, and Pierre'soverflow: clipon[data-separator-content]cuts it to"2 u".::before/::afterflex children of[data-unmodified-lines](L124–147), so they get no space either.--code-background/transparent. That hides the bar Pierre would otherwise paint on the additions side, so the rest of the row ends up blank.@pierre/diffs1.5.2 bump (#16644). Pierre's separator CSS is essentially the same in 1.3.0-beta.10 and 1.5.2.Reproduction
I rendered Pierre 1.5.2's output together with our
DIFF_VIEW_UNSAFE_CSSin headless Chrome, outside the app. Split mode showed the same clipped"9 u"label in the gutter with nothing across the rest of the row. Unified mode looked correct. I haven't checked this in the desktop app itself.Suggested fix (in
StyledDiffCodeView.tsx)Add split-mode rules next to the existing separator block, for example:
In the same static render, this gives a centered "N unmodified lines" label with the divider across the left column and a matching line on the right.
Caveats:
[data-code] { display: contents }, so there's no per-column container and100cqiwould resolve against the viewport. Wrap mode probably needs a separate rule, for example styling the separator cell in[data-content]instead.Related: #17156 (GitLab "expand unmodified lines" does nothing) is in the same area but is a separate bug.