emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/company dbb5d8c: Scale icon down if the font is too nar


From: ELPA Syncer
Subject: [elpa] externals/company dbb5d8c: Scale icon down if the font is too narrow
Date: Mon, 3 May 2021 08:57:07 -0400 (EDT)

branch: externals/company
commit dbb5d8cac2d7b854e883b381c7504e227a7185eb
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    Scale icon down if the font is too narrow
---
 company.el | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/company.el b/company.el
index 0dfc49b..fbd9363 100644
--- a/company.el
+++ b/company.el
@@ -1446,11 +1446,16 @@ end of the match."
                          ;; (aref (font-info (face-font 'default)) 2)
                          ((and (consp company-icon-size)
                                (eq 'auto-scale (car company-icon-size)))
-                          (let ((base-size (cdr company-icon-size)))
-                            (if (> (default-font-height)
-                                   (* 2 base-size))
-                                (* 2 base-size)
-                              base-size)))))
+                          (let ((base-size (cdr company-icon-size))
+                                (dfw (default-font-width))
+                                size)
+                            (setq size (if (> (default-font-height)
+                                              (* 2 base-size))
+                                           (* 2 base-size)
+                                         base-size))
+                            (when (> size (* 2 dfw))
+                              (setq size (* 2 dfw)))
+                            size))))
              (spec (list 'image
                          :file (expand-file-name icon-file root-dir)
                          :type 'svg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]