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

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

[elpa] externals/kind-icon f950f4ac1d: Propertize the 'display string to


From: ELPA Syncer
Subject: [elpa] externals/kind-icon f950f4ac1d: Propertize the 'display string to work with overlays
Date: Thu, 19 May 2022 15:57:37 -0400 (EDT)

branch: externals/kind-icon
commit f950f4ac1d9a79f36ce3c0316a5d53ac6ff80cd0
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>

    Propertize the 'display string to work with overlays
---
 kind-icon.el | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/kind-icon.el b/kind-icon.el
index 8af0a99818..2661a0dfa3 100644
--- a/kind-icon.el
+++ b/kind-icon.el
@@ -278,27 +278,30 @@ background-color."
                 (dfw (default-font-width))
                 (terminal (eq dfw 1))
                 (half (/ dfw 2))
-                (pad-right (propertize " " 'display `(space :width (,half))))
-                (pad-left (propertize " " 'display `(space :width (,(- dfw 
half)))))
+                (face-spec `(:weight bold :foreground ,col :background 
,bg-col))
+                (pad-right (propertize " " 'display `(space :width (,half))
+                                       'face face-spec))
+                (pad-left (propertize " " 'display `(space :width (,(- dfw 
half)))
+                                      'face face-spec))
                 (disp (if-let ((kind-icon-use-icons)
                                (icon-name (plist-get plist :icon))
                                (icon (kind-icon--get-icon-safe icon-name col 
bg-col)))
                           ;; icon: always 2x1, half-space on each side
                           (propertize ; pretend it's one char to allow padding
-                           (concat pad-left (propertize "*" 'display icon) 
pad-right)
-                           'face `(:background ,bg-col))
+                           (concat pad-left
+                                   (propertize "*" 'display icon 'face 
`(:background ,bg-col))
+                                   pad-right))
                         ;; text, 1 or 2 chars, centered with full or half 
space on each side
                         (let* ((txt (truncate-string-to-width (cadr map) 2))
-                               (len (length txt))
-                               (txt-disp (if (eq len 2)
-                                             (if terminal
-                                                 (concat txt " ")
-                                               (concat pad-left
-                                                       (propertize "_" 
'display txt)
-                                                       pad-right))
-                                           (concat " " txt " "))))
-                          (propertize txt-disp 'face
-                                      `(:weight bold :foreground ,col 
:background ,bg-col))))))
+                               (len (length txt)))
+                          (if (eq len 2)
+                              (if terminal
+                                  (propertize (concat txt " ") 'face face-spec)
+                                (concat pad-left
+                                        (propertize "_" 'display
+                                                    (propertize txt 'face 
face-spec))
+                                        pad-right))
+                            (propertize (concat " " txt " ") 'face 
face-spec))))))
            (if disp
                (setf (alist-get kind kind-icon--cache) disp)
              (propertize (concat pad-left "??" pad-right) 'face 
font-lock-warning-face)))



reply via email to

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