view: Wrap contents of diff lines with pre.
authorRicardo Wurmus <rekado@elephly.net>
Thu, 9 Dec 2021 17:39:47 +0000 (18:39 +0100)
committerRicardo Wurmus <rekado@elephly.net>
Thu, 9 Dec 2021 17:39:47 +0000 (18:39 +0100)
Fixes <https://issues.guix.gnu.org/43166>.

assets/css/screen.css
mumi/web/view/utils.scm

index f4939902dd19a20068b4f819b907a1a3f8572fd9..e4dcc10f2ae8d27df4a47f551665de5a86970a39 100644 (file)
@@ -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;
 }
index 0a43b065c6beb83443934e8858a1aeecb957ab59..9789d03e205e63bf9e7fc19f125c21efbb235c21 100644 (file)
@@ -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))))