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

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

[elpa] externals/company df218ec 2/2: New user option: company-icon-marg


From: ELPA Syncer
Subject: [elpa] externals/company df218ec 2/2: New user option: company-icon-margin
Date: Tue, 10 Aug 2021 22:57:07 -0400 (EDT)

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

    New user option: company-icon-margin
    
    Requested in 
https://www.reddit.com/r/emacs/comments/p1lcgv/companymode_posframe_icons/.
---
 NEWS.md    |  1 +
 company.el | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index 21d9ec2..d6e294ef 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,7 @@
 
 ## Next
 
+* New user option `company-icon-margin`.
 * `company-show-numbers` has been renamed to `company-show-quick-access`
   ([#1115](https://github.com/company-mode/company-mode/pull/1115)).
   New user options `company-quick-access-keys` and
diff --git a/company.el b/company.el
index d35698f..1fffe96 100644
--- a/company.el
+++ b/company.el
@@ -1551,6 +1551,10 @@ end of the match."
                        (const auto-scale)
                        (integer :value 16))))
 
+(defcustom company-icon-margin 2
+  "Width of the margin that shows the icons, in characters."
+  :type 'integer)
+
 (defun company--render-icons-margin (icon-mapping root-dir candidate selected)
   (if-let ((ws (window-system))
            (candidate candidate)
@@ -1575,7 +1579,7 @@ end of the match."
                              (if (> dfh (* 2 base-size))
                                  (* 2 base-size)
                                base-size)
-                             (* 2 dfw))))))
+                             (* company-icon-margin dfw))))))
              (spec (list 'image
                          :file (expand-file-name icon-file root-dir)
                          :type 'svg
@@ -1584,10 +1588,11 @@ end of the match."
                          :ascent 'center
                          :background (unless (eq bkg 'unspecified)
                                        bkg)))
-             (spacer-px-width (- (* 2 dfw) icon-size)))
+             (spacer-px-width (- (* company-icon-margin dfw) icon-size)))
         (concat
          (propertize " " 'display spec)
-         (propertize " " 'display `(space . (:width (,spacer-px-width))))))
+         (propertize (company-space-string (1- company-icon-margin))
+                     '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]