Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Side-by-side diff squeezes the "N unmodified lines" divider into the line-number column #17157

Closedsaibotma(GitHub profile, opens in a new tab) opened this issue 1 comment

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open a diff with collapsed unchanged lines, for example in the PR pane's Code tab.
  2. Switch to side-by-side view.
  3. Look at the divider between two hunks.

Expected behavior

The divider spans the full width and reads "2 unmodified lines", with the same line and hover styling as in the unified view.

Actual behavior

The label is squeezed into the left line-number column and cut off to "2 u". The rest of the row is blank, with no divider line.

Impact

Cosmetic issue

Version or commit

0.0.46-nightly.20261008.2813

Environment

macOS, desktop app

Screenshots, recordings, or supporting files

Image
  1. 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/diffs draws the hunk separator inside the line-number gutter. The label wrapper is position: absolute; inset-inline: 0, so by default it's only as wide as the gutter (createSeparator.js, pushSeparator in DiffHunksRenderer.js ~L1148).
    • In unified mode, Pierre widens that wrapper with [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.
    • Our override in apps/web/src/components/diffs/StyledDiffCodeView.tsx assumes the wrapper is always full width:
      • L149–157 set grid-template-columns: 0 minmax(0, 1fr) with the content in column 2. That clamps the label to the gutter width, and Pierre's overflow: clip on [data-separator-content] cuts it to "2 u".
      • The divider lines are ::before/::after flex children of [data-unmodified-lines] (L124–147), so they get no space either.
      • L101–111 make the separator row and wrapper backgrounds --code-background/transparent. That hides the bar Pierre would otherwise paint on the additions side, so the rest of the row ends up blank.
    • This override seems to date back to the diff restyle in #5260 (August), so it doesn't look like a regression from the recent @pierre/diffs 1.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_CSS in 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:

    @supports (width: 1cqi) {
      [data-deletions] [data-gutter]
        :is([data-separator="line-info"], [data-separator="line-info-basic"])
        [data-separator-wrapper] {
        width: 100cqi !important; /* span the deletions column, like Pierre's unified rule */
      }
      [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
        display: flex !important;
        align-items: center;
        padding-inline: 12px !important;
      }
      [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper]::before {
        content: "";
        flex: 1 1 auto;
        height: 1px;
        background-color: color-mix(in srgb, var(--code-background) 92%, var(--code-foreground));
      }
    }

    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:

    • With word wrap on, Pierre lays split diffs out with [data-code] { display: contents }, so there's no per-column container and 100cqi would resolve against the viewport. Wrap mode probably needs a separate rule, for example styling the separator cell in [data-content] instead.
    • I haven't checked that hover styling and click-to-expand still behave the same.

    Related: #17156 (GitLab "expand unmodified lines" does nothing) is in the same area but is a separate bug.

  2. juliusmarminge added labelsbug

  3. juliusmarminge added labelsvia-triage

  4. juliusmarminge closed this

Sign in to join this conversation.