branch: externals/olivetti
commit cb22f8ab14b7a7ad3b3650b0e36a1b61d1253950
Merge: 0227265 d40a054
Author: Paul W. Rankin <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #25 from Nielius/fix-scale-width
Fixed olivetti-scale-width for integer heights
---
olivetti.el | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/olivetti.el b/olivetti.el
index 0998e80..16c177f 100644
--- a/olivetti.el
+++ b/olivetti.el
@@ -275,11 +275,15 @@ instead `olivetti-set-mode-line'."
For compatibility with `text-scale-mode', if
`face-remapping-alist' includes a :height property on the default
-face, scale N by that factor, otherwise scale by 1."
- (* n (or (plist-get (cadr (assq 'default
- face-remapping-alist))
- :height)
- 1)))
+face, scale N by that factor if it is a fraction, by (height/100)
+if it is an integer, and otherwise scale by 1."
+ (let
+ ((height (plist-get (cadr (assq 'default face-remapping-alist))
:height)))
+ (cond
+ ((integerp height) (* n (/ height 100.0)))
+ ((floatp height) (* n height))
+ (t n))))
+
(defun olivetti-safe-width (width window)
"Parse WIDTH to a safe value for `olivetti-body-width' for WINDOW.