Skip to content

Commit 82693fa

Browse files
fix: Handle cons cell value for line-spacing
The `line-spacing` variable can be a [cons cell][1] from Emacs 31, such as `(0.1 . 0.1)`, in addition to a plain number. Each value in this cons is spacing above and below the line. The correct value of line-spacing would be to use [`total-line-spacing`][1] instead of raw value. The previous code did not handle the cons cell format, leading to a `wrong-type-argument` error. For backward compatibility, this change inlines the definition of `total-line-spacing` i.e. sums the above and below spacing in case if it's cons. [1]: emacs-mirror/emacs@e8f26d5
1 parent e79aa49 commit 82693fa

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

diff-hl.el

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,13 @@ It can be a relative expression as well, such as \"HEAD^\" with Git, or
315315
(expt text-scale-mode-step text-scale-mode-amount)
316316
1))
317317
(spacing (or (and (display-graphic-p) (default-value 'line-spacing)) 0))
318+
(total-spacing (pcase spacing
319+
((pred numberp) spacing)
320+
(`(,above . ,below) (+ above below))))
318321
(h (+ (ceiling (* (frame-char-height) scale))
319-
(if (floatp spacing)
320-
(truncate (* (frame-char-height) spacing))
321-
spacing)))
322+
(if (floatp total-spacing)
323+
(truncate (* (frame-char-height) total-spacing))
324+
total-spacing)))
322325
(w (min (frame-parameter nil (intern (format "%s-fringe" diff-hl-side)))
323326
diff-hl-bmp-max-width))
324327
(_ (when (zerop w) (setq w diff-hl-bmp-max-width)))

0 commit comments

Comments
 (0)