Improve diff display again

Julien LepillerSun Mar 07 04:08:13+0100 2021

6215762

Improve diff display again

gitile/pages.scm

206206
    (diff-foreach diff
207207
      (lambda (delta progress)
208208
        (when file-header
209-
          (set! content (append content (cons file-header `((table (@ (class "file-diff")) ,@(reverse file-content)))))))
209+
          (set! content (append content (cons file-header `((table (@ (class "file-diff")) ,file-content))))))
210210
        (set! first-hunk #t)
211211
        (set! file-content '())
212212
        (cond

221221
                  ,(number->string (diff-delta-status delta))))))
222222
        0)
223223
      (lambda (delta binary)
224-
        (set! file-content `((tr (@ (class "hunk-delim")) (td (@ (colspan 4)) "Binary data"))))
224+
        (set! file-content
225+
          `((tr (@ (class "hunk-delim")) (td (@ (colspan 4)) (p "Binary data")))))
225226
        0)
226227
      (lambda (delta hunk)
227228
        (if first-hunk

244245
              ((line lines ...)
245246
               (set! file-content
246247
                 (append file-content `((tr (@ (class ,class))
247-
                                          (td ,(if (= old-line -1) "" old-line))
248-
                                          (td ,(if (= new-line -1) "" new-line))
248+
                                          (td (@ (class "diff-line-num"))
249+
                                              ,(if (= old-line -1) "" old-line))
250+
                                          (td (@ (class "diff-line-num"))
251+
                                              ,(if (= new-line -1) "" new-line))
249252
                                          (td ,origin)
250253
                                          (td (@ (class "diff-line"))
251-
                                              (pre ,line "\n"))))))
254+
                                              (pre ,line))))))
252255
               (loop lines (+ old-line 1) (+ new-line 1))))))
253256
        0))
254-
    (append content (cons file-header `((table (@ (class "file-diff")) ,@(reverse file-content)))))))
257+
    (append content (cons file-header `((table (@ (class "file-diff")) ,file-content))))))