Improve diff display

Julien LepillerSun Mar 07 03:32:01+0100 2021

9ece260

Improve diff display

gitile/pages.scm

212212
        (cond
213213
          ((equal? (diff-delta-status delta) GIT-DELTA-MODIFIED)
214214
           (set! file-header
215-
             `(p (@ (class "file-name")) ,(diff-file-path (diff-delta-old-file delta)))))
215+
             `(p (@ (class "diff-file-name")) ,(diff-file-path (diff-delta-old-file delta)))))
216216
          (else
217217
            (set! file-header
218-
              `(p (@ (class "file-name"))
218+
              `(p (@ (class "diff-file-name"))
219219
                  ,(diff-file-path (diff-delta-old-file delta))
220220
                  " unknown status "
221221
                  ,(number->string (diff-delta-status delta))))))

243243
              (("") #t)
244244
              ((line lines ...)
245245
               (set! file-content
246-
                 (append file-content `((tr
247-
                                          (td ,old-line)
248-
                                          (td ,new-line)
246+
                 (append file-content `((tr (@ (class ,class))
247+
                                          (td ,(if (= old-line -1) "" old-line))
248+
                                          (td ,(if (= new-line -1) "" new-line))
249249
                                          (td ,origin)
250-
                                          (td (@ (class ,(string-append class " diff-line")))
250+
                                          (td (@ (class "diff-line"))
251251
                                              (pre ,line "\n"))))))
252252
               (loop lines (+ old-line 1) (+ new-line 1))))))
253253
        0))