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

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

[elpa] externals/company a0adb3c 2/2: Specify spacer width in pixels


From: ELPA Syncer
Subject: [elpa] externals/company a0adb3c 2/2: Specify spacer width in pixels
Date: Mon, 3 May 2021 16:57:06 -0400 (EDT)

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

    Specify spacer width in pixels
    
    The fractional format doesn't account for face remapping (text-scale-mode, 
etc).
    
    Popup positioning is still off when text-scale is in effect, but that seems 
less
    jarring, with no background text getting randomly offset.
---
 company.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/company.el b/company.el
index 236de36..6ec9054 100644
--- a/company.el
+++ b/company.el
@@ -1439,6 +1439,7 @@ end of the match."
                                       'company-tooltip-selection
                                     'company-tooltip)
                                   :background))
+             (dfw (default-font-width))
              (icon-size (cond
                          ((integerp company-icon-size)
                           company-icon-size)
@@ -1447,7 +1448,6 @@ end of the match."
                          ((and (consp company-icon-size)
                                (eq 'auto-scale (car company-icon-size)))
                           (let ((base-size (cdr company-icon-size))
-                                (dfw (default-font-width))
                                 (dfh (default-font-height)))
                             (min
                              (if (> dfh (* 2 base-size))
@@ -1461,10 +1461,11 @@ end of the match."
                          :height icon-size
                          :ascent 'center
                          :background (unless (eq bkg 'unspecified)
-                                       bkg))))
+                                       bkg)))
+             (spacer-px-width (- (* 2 dfw) icon-size)))
         (concat
          (propertize " " 'display spec)
-         (propertize " " 'display `(space . (:width ,(- 2 (car (image-size 
spec))))))))
+         (propertize " " 'display `(space . (:width (,spacer-px-width))))))
     nil))
 
 (defun company-vscode-dark-icons-margin (candidate selected)



reply via email to

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