From 86268801d1f2af2be304bdc878613edba0082507 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 16 Oct 2026 13:20:29 +0200 Subject: [PATCH] html: strip source-cell markup from gap cells A gap cell holds no source line, yet it carried the source-side class and a data-side attribute that only style source text. Emit a gap with just its class and tooltip, and drop the stylesheet rule that undid the source-cell background for gaps. This removes about 3% of a large report's size. --- samples/arguments.html | 9 ++++----- samples/indentation.html | 7 +++---- src/html.c | 8 +++++--- src/html.css | 1 - tests/check-highlight.py | 2 +- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/samples/arguments.html b/samples/arguments.html index 3f25e9d..521832d 100644 --- a/samples/arguments.html +++ b/samples/arguments.html @@ -246,7 +246,6 @@ .source-side.remove { --source-background: var(--remove); } html[data-shared="true"] .source-side.shared { --source-background: var(--shared); } html[data-shared="false"] .chip.shared { background: var(--header); } -.gap { background: transparent; } html[data-gaps="false"] .hunk { background-image: none; } .sign, .number { color: var(--muted); user-select: none; text-align: right; padding-right: 1ch; } .sign { padding-right: .4ch; color: var(--text); } @@ -377,8 +376,8 @@

Within aligned pairs: left text / right text that differs, independently of patch signs. Whitespace uses the same colors: separate space blocks distinguish spaces from tabs; tabs fill their tab stops. Hover for details.

Delta differences

Code changes that differ between the patches. Old / new are each patch’s parent / result line numbers. Signs belong to that patch. Shared edits are additions or removals both patches make.

record.crecord.c

oldnew
oldnew
static void update_record(struct record *record, int value)
static void update_record(struct record *record, int value)
11static void update_record(struct record *record, int value)
11static void update_record(struct record *record, int value)
22{
22{
-
33 if (!record->active)
-
44 return;
+
33 if (!record->active)
+
44 return;
+3 write_seqcount_begin(&record->seq);
+5 write_seqcount_begin(&record->state.seq);
34 record->value = value;
56 record->value = value;
+5 record->generation++;
+7 record->generation++;
@@ -389,8 +388,8 @@

Context differences

Surrounding code in the results. Signs mark lines present in only one result: − left, + right.

record.crecord.c

new
new
static void update_record(struct record *record, int value)
static void update_record(struct record *record, int value)
1static void update_record(struct record *record, int value)
1static void update_record(struct record *record, int value)
2{
2{
-
+3 if (!record->active)
-
+4 return;
+
+3 if (!record->active)
+
+4 return;
-3 write_seqcount_begin(&record->seq);
+5 write_seqcount_begin(&record->state.seq);
4 record->value = value;
6 record->value = value;
5 record->generation++;
7 record->generation++;
diff --git a/samples/indentation.html b/samples/indentation.html index a205474..597f341 100644 --- a/samples/indentation.html +++ b/samples/indentation.html @@ -246,7 +246,6 @@ .source-side.remove { --source-background: var(--remove); } html[data-shared="true"] .source-side.shared { --source-background: var(--shared); } html[data-shared="false"] .chip.shared { background: var(--header); } -.gap { background: transparent; } html[data-gaps="false"] .hunk { background-image: none; } .sign, .number { color: var(--muted); user-select: none; text-align: right; padding-right: 1ch; } .sign { padding-right: .4ch; color: var(--text); } @@ -374,10 +373,10 @@
-

Within aligned pairs: left text / right text that differs, independently of patch signs. Whitespace uses the same colors: separate space blocks distinguish spaces from tabs; tabs fill their tab stops. Hover for details.

Delta differences

Code changes that differ between the patches. Old / new are each patch’s parent / result line numbers. Signs belong to that patch. Shared edits are additions or removals both patches make.

request.crequest.c

oldnew
oldnew
33 int ret = -EAGAIN;
+

Within aligned pairs: left text / right text that differs, independently of patch signs. Whitespace uses the same colors: separate space blocks distinguish spaces from tabs; tabs fill their tab stops. Hover for details.

Delta differences

Code changes that differ between the patches. Old / new are each patch’s parent / result line numbers. Signs belong to that patch. Shared edits are additions or removals both patches make.

request.crequest.c

oldnew
oldnew
33 int ret = -EAGAIN;
44
44
55 if (req->ready) {
55 if (!req->ready)
-
66 return -EAGAIN;
+
66 return -EAGAIN;
+6 req->attempts++;
+7 req->attempts++;
+7 trace_submit(req);
+8 trace_submit(req);
68 ret = queue_request(req);
79 ret = queue_request(req);
@@ -394,7 +393,7 @@

Context differences

Surrounding code in the results. Signs mark lines present in only one result: − left, + right.

request.crequest.c

new
new
4
4
-5 if (req->ready) {
+5 if (!req->ready)
-
+6 return -EAGAIN;
+
+6 return -EAGAIN;
-6 req->attempts++;
+7 req->attempts++;
-7 trace_submit(req);
+8 trace_submit(req);
-8 ret = queue_request(req);
+9 ret = queue_request(req);
diff --git a/src/html.c b/src/html.c index f08a01c..2048fdb 100644 --- a/src/html.c +++ b/src/html.c @@ -181,13 +181,15 @@ static void write_source_cell(FILE *out, const struct review_row *row, else if (row->sign == '-') kind = "remove"; - fprintf(out, "
text ? kind : "gap", leg); + /* A gap holds no source, so it takes none of a source cell's styling */ if (!row->text) { - fputs(" title=\"No aligned source line; this is a gap, not a blank source line.\">
", + fputs("
", out); return; } + + fprintf(out, "
shared) fputs(" title=\"Both patches make this edit; its counterpart may occur at another position.\"", out); diff --git a/src/html.css b/src/html.css index 8b47bb4..978887e 100644 --- a/src/html.css +++ b/src/html.css @@ -154,7 +154,6 @@ summary { cursor: pointer; } .source-side.remove { --source-background: var(--remove); } html[data-shared="true"] .source-side.shared { --source-background: var(--shared); } html[data-shared="false"] .chip.shared { background: var(--header); } -.gap { background: transparent; } html[data-gaps="false"] .hunk { background-image: none; } .sign, .number { color: var(--muted); user-select: none; text-align: right; padding-right: 1ch; } .sign { padding-right: .4ch; color: var(--text); } diff --git a/tests/check-highlight.py b/tests/check-highlight.py index d15ac96..5a080a5 100644 --- a/tests/check-highlight.py +++ b/tests/check-highlight.py @@ -86,7 +86,7 @@ def handle_starttag(self, tag, attributes): self.subjects.append('') if tag == 'div' and self.stack and 'operands' in self.stack[-1][1].get('class', '').split(): self.identities.append('') - if 'source-side' in classes: + if 'source-side' in classes or 'gap' in classes: assert self.current is None self.current = dict(gap='gap' in classes, source='', sign='', old='', new='', newline=attrs.get('data-newline'), depth=len(self.stack),