summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2021-12-09 18:39:47 +0100
committerRicardo Wurmus <rekado@elephly.net>2021-12-09 18:39:47 +0100
commit8a45281801ade7524dbdee423c28b326051719de (patch)
treec875acf755fb54da6a325ca3841a8e693d805f09
parent599da59a269932b29491956a75b4ac35e78c76c8 (diff)
view: Wrap contents of diff lines with pre.
Fixes <https://issues.guix.gnu.org/43166>.
-rw-r--r--assets/css/screen.css7
-rw-r--r--mumi/web/view/utils.scm10
2 files changed, 12 insertions, 5 deletions
diff --git a/assets/css/screen.css b/assets/css/screen.css
index f493990..e4dcc10 100644
--- a/assets/css/screen.css
+++ b/assets/css/screen.css
@@ -377,6 +377,13 @@ details {
}
/* diff styles */
+div.line pre {
+ margin: 0;
+ font-family: inherit;
+ font-size: inherit;
+ color: inherit;
+}
+
.message .diff div.line.diff.file {
color: #005cc5;
}
diff --git a/mumi/web/view/utils.scm b/mumi/web/view/utils.scm
index 0a43b06..9789d03 100644
--- a/mumi/web/view/utils.scm
+++ b/mumi/web/view/utils.scm
@@ -80,22 +80,22 @@ with the next context."
(cond
((string= "---" line)
`(div (@ (class "line diff separator"))
- ,line-anchor ,line))
+ ,line-anchor (pre ,line)))
((string-prefix? "+" line)
`(div (@ (class "line diff addition"))
- ,line-anchor ,line))
+ ,line-anchor (pre ,line)))
((and (string-prefix? "-" line)
(not (string= "--" line))
(not (string= "-- " line)))
`(div (@ (class "line diff deletion"))
- ,line-anchor ,line))
+ ,line-anchor (pre ,line)))
((string-prefix? "@@" line)
`(div (@ (class "line diff range"))
- ,line-anchor ,line))
+ ,line-anchor (pre ,line)))
(else
`(div (@ (class "line"))
,line-anchor
- ,line)))))
+ (pre ,line))))))
(values (cons (add-block-line! block formatted-line)
other-blocks)
context))))