Skip to content

Commit 14a175a

Browse files
var-ggclaude
andcommitted
fix(diff): opaque sticky-gutter so horizontal-scrolled text doesn't bleed through
The line-number + sign cells were sticky-left with `background: inherit`, which inherited the row's semi-transparent tint (rgba 0.10–0.18) from .sbs-line. On narrow diff windows where the content overflows horizontally, the scrolled body text showed through the sticky gutter and the two visually overlapped — pretty much the worst-case readability state. Switched to the same pattern GitHub / GitLab / VS Code's monaco diff use: each row type (context / delete / add / blank) gets a SOLID gutter colour that equals its rgba tint pre-blended against the body bg (#fafafa light / #1a1a1a dark). At column-resting state the gutter is visually indistinguishable from the row, but during horizontal scroll it actually paints opaquely instead of letting text through. Added z-index: 1 on both gutter cells so paint-order is unambiguous, and a thin border-right on .sbs-sign so the gutter / content boundary stays visible during scroll. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 334bc64 commit 14a175a

1 file changed

Lines changed: 56 additions & 2 deletions

File tree

src/styles.css

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,6 +1787,18 @@ body,
17871787
}
17881788
}
17891789

1790+
/* Gutter cells (line number + +/- sign) are sticky-left so they stay
1791+
visible during the diff window's horizontal scroll. They MUST have
1792+
an opaque background or the scrolled body text bleeds through them
1793+
visually — `background: inherit` from .sbs-line was inheriting the
1794+
row's semi-transparent tint (rgba 0.10~0.18) which is exactly the
1795+
wrong choice for a sticky overlay. Following the same pattern as
1796+
GitHub / GitLab / VS Code's monaco diff: per-row-type SOLID colour
1797+
pre-blended against the body bg (#fafafa light / #1a1a1a dark) so
1798+
the gutter looks identical to the row tint at column-resting state
1799+
AND obscures content underneath when the row scrolls horizontally.
1800+
The sign cell carries a thin right border so the gutter/content
1801+
boundary stays visible during scroll. */
17901802
.sbs-num {
17911803
text-align: right;
17921804
opacity: 0.45;
@@ -1795,7 +1807,8 @@ body,
17951807
padding-right: 6px;
17961808
position: sticky;
17971809
left: 0;
1798-
background: inherit;
1810+
background: #fafafa;
1811+
z-index: 1;
17991812
}
18001813

18011814
.sbs-sign {
@@ -1805,7 +1818,29 @@ body,
18051818
font-weight: 700;
18061819
position: sticky;
18071820
left: calc(44px * var(--ui-scale, 1));
1808-
background: inherit;
1821+
background: #fafafa;
1822+
border-right: 1px solid rgba(0, 0, 0, 0.06);
1823+
z-index: 1;
1824+
}
1825+
1826+
/* Solid pre-blended row colours for the sticky gutter. Each value
1827+
equals the corresponding .sbs-line.<type> rgba tint flattened onto
1828+
the body bg so at column-resting state the gutter is visually
1829+
indistinguishable from the row, but during horizontal scroll it
1830+
actually paints opaquely instead of letting text through. */
1831+
.sbs-line.delete .sbs-num,
1832+
.sbs-line.delete .sbs-sign {
1833+
background: rgb(247, 233, 233);
1834+
}
1835+
1836+
.sbs-line.add .sbs-num,
1837+
.sbs-line.add .sbs-sign {
1838+
background: rgb(233, 245, 237);
1839+
}
1840+
1841+
.sbs-line.blank .sbs-num,
1842+
.sbs-line.blank .sbs-sign {
1843+
background: rgb(246, 246, 246);
18091844
}
18101845

18111846
.sbs-line.delete .sbs-sign {
@@ -1817,6 +1852,25 @@ body,
18171852
}
18181853

18191854
@media (prefers-color-scheme: dark) {
1855+
.sbs-num,
1856+
.sbs-sign {
1857+
background: #1a1a1a;
1858+
}
1859+
.sbs-sign {
1860+
border-right-color: rgba(255, 255, 255, 0.06);
1861+
}
1862+
.sbs-line.delete .sbs-num,
1863+
.sbs-line.delete .sbs-sign {
1864+
background: rgb(61, 36, 36);
1865+
}
1866+
.sbs-line.add .sbs-num,
1867+
.sbs-line.add .sbs-sign {
1868+
background: rgb(35, 54, 41);
1869+
}
1870+
.sbs-line.blank .sbs-num,
1871+
.sbs-line.blank .sbs-sign {
1872+
background: rgb(33, 33, 33);
1873+
}
18201874
.sbs-line.delete .sbs-sign { color: rgba(255, 130, 130, 1); }
18211875
.sbs-line.add .sbs-sign { color: rgba(120, 220, 150, 1); }
18221876
}

0 commit comments

Comments
 (0)