Commit cf58aba82d
cf58aba82d7b7207bd2c347efe9fcfe6e672deac
parent: 0db33b1ad1
Verified · cmc ci/build: success
cmc <hello@cleberg.net> · 2026-08-26T22:48:40Z
web: the add/delete tint spans the whole diff row
The diff cell used class "code", which collides with the blob
code-block style and its background — so every row's tint was painted
over everywhere except the line-number gutters. The cell is .src now.
e2e/diffweb_test.go
+6 −1
| @@ -83,9 +83,14 @@ func TestDiffRendering(t *testing.T) { |
| 83 | 83 | t.Error("diff content is not syntax highlighted") |
| 84 | 84 | } |
| 85 | 85 | // The +/- markers are CSS, so a copied selection is real source. |
| 86 | | if strings.Contains(body, `<td class="code">+`) { |
| 86 | if strings.Contains(body, `<td class="src">+`) { |
| 87 | 87 | t.Error("diff markers are in the markup, not the stylesheet") |
| 88 | 88 | } |
| 89 | // The cell must not use .code: that class carries its own background, |
| 90 | // which would paint over the add/delete row tint. |
| 91 | if strings.Contains(body, `<td class="code">`) { |
| 92 | t.Error("diff cells use the blob code class, whose background hides the row tint") |
| 93 | } |
| 89 | 94 | } |
| 90 | 95 | |
| 91 | 96 | // jsonField pulls the first "name":"value" string out of a JSON blob. |
internal/web/static/style.css
+7 −5
| @@ -945,16 +945,18 @@ table.difftable td.ln { |
| 945 | 945 | border-right: 1px solid var(--line); |
| 946 | 946 | white-space: nowrap; |
| 947 | 947 | } |
| 948 | | table.difftable td.code { |
| 948 | /* not .code: that class is the blob/code-block style and carries its own |
| 949 | background, which painted over every row tint */ |
| 950 | table.difftable td.src { |
| 949 | 951 | padding: 0 var(--sp-3); |
| 950 | 952 | white-space: pre-wrap; |
| 951 | 953 | overflow-wrap: anywhere; |
| 952 | 954 | } |
| 953 | 955 | /* the marker is decoration, so it lives in CSS and stays out of a copied |
| 954 | 956 | selection */ |
| 955 | | table.difftable tr.add td.code::before { content: "+"; color: var(--ok); } |
| 956 | | table.difftable tr.del td.code::before { content: "\2212"; color: var(--bad); } |
| 957 | | table.difftable tr.ctx td.code::before { content: " "; } |
| 957 | table.difftable tr.add td.src::before { content: "+"; color: var(--ok); } |
| 958 | table.difftable tr.del td.src::before { content: "\2212"; color: var(--bad); } |
| 959 | table.difftable tr.ctx td.src::before { content: " "; } |
| 958 | 960 | table.difftable tr.add { background: var(--diff-add); } |
| 959 | 961 | table.difftable tr.del { background: var(--diff-del); } |
| 960 | 962 | table.difftable tr.hunk td, table.difftable tr.dmeta td { |
| @@ -964,7 +966,7 @@ table.difftable tr.hunk td, table.difftable tr.dmeta td { |
| 964 | 966 | border-top: 1px solid var(--line); |
| 965 | 967 | border-bottom: 1px solid var(--line); |
| 966 | 968 | } |
| 967 | | table.difftable tr.hunk td.code { color: var(--accent); } |
| 969 | table.difftable tr.hunk td.src { color: var(--accent); } |
| 968 | 970 | table.difftable tr.threadrow td { padding: var(--sp-2) var(--sp-3); background: var(--bg); } |
| 969 | 971 | |
| 970 | 972 | /* badges: signature and check states. Semantic colors stay distinct: |
internal/web/templates/layout.html
+3 −3
| @@ -126,9 +126,9 @@ |
| 126 | 126 | </summary> |
| 127 | 127 | {{if .Binary}}<p class="none">Binary file not shown.</p> |
| 128 | 128 | {{else}}<div class="tablewrap"><table class="difftable"> |
| 129 | | {{range .Lines}}{{if eq .Class "hunk"}}<tr class="hunk"><td class="ln" colspan="2"></td><td class="code">{{.Text}}</td></tr> |
| 130 | | {{else if eq .Class "meta"}}<tr class="dmeta"><td class="ln" colspan="2"></td><td class="code">{{.Text}}</td></tr> |
| 131 | | {{else}}<tr class="{{.Class}}"><td class="ln">{{if .OldLine}}{{.OldLine}}{{end}}</td><td class="ln">{{if .NewLine}}{{.NewLine}}{{end}}</td><td class="code">{{if .Code}}{{.Code}}{{else}}{{.Content}}{{end}}</td></tr> |
| 129 | {{range .Lines}}{{if eq .Class "hunk"}}<tr class="hunk"><td class="ln" colspan="2"></td><td class="src">{{.Text}}</td></tr> |
| 130 | {{else if eq .Class "meta"}}<tr class="dmeta"><td class="ln" colspan="2"></td><td class="src">{{.Text}}</td></tr> |
| 131 | {{else}}<tr class="{{.Class}}"><td class="ln">{{if .OldLine}}{{.OldLine}}{{end}}</td><td class="ln">{{if .NewLine}}{{.NewLine}}{{end}}</td><td class="src">{{if .Code}}{{.Code}}{{else}}{{.Content}}{{end}}</td></tr> |
| 132 | 132 | {{end}}{{range .Threads}}<tr class="threadrow"><td colspan="3"><div class="thread{{if .Resolved}} resolved{{end}}">{{if .Resolved}}<p class="threadstate">resolved by {{.Resolved}}</p>{{end}}{{range .Comments}}<p class="commenthead"><strong>{{.Author}}</strong> <span class="when">{{when .CreatedAt}}</span></p><div class="rendered">{{.BodyHTML}}</div>{{end}}{{template "threadact" dict "ID" .ID "Resolved" .Resolved "Base" $base "Can" $can}}</div></td></tr> |
| 133 | 133 | {{end}}{{end}} |
| 134 | 134 | </table></div>{{end}} |