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

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

[elpa] externals/company bbff400 27/46: Fix tooltip background stretchin


From: Dmitry Gutov
Subject: [elpa] externals/company bbff400 27/46: Fix tooltip background stretching to EOL
Date: Wed, 30 Dec 2020 18:33:08 -0500 (EST)

branch: externals/company
commit bbff4007ac7d8e5dbc679f8e1f6a750d863ee861
Author: Henrik Lissner <henrik@lissner.net>
Commit: Henrik Lissner <henrik@lissner.net>

    Fix tooltip background stretching to EOL
    
    When default face has been remapped
---
 company.el | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/company.el b/company.el
index c6847b5..b4e40c2 100644
--- a/company.el
+++ b/company.el
@@ -2746,6 +2746,22 @@ If SHOW-VERSION is non-nil, show the version in the echo 
area."
       (cl-decf ww (1- (length (aref buffer-display-table ?\n)))))
     ww))
 
+(defun company--face-attribute (face attr)
+  ;; Like `face-attribute', but accounts for faces that have been remapped to
+  ;; another face, a list of faces, or a face spec.
+  (cond ((symbolp face)
+         (let ((remap (cadr (assq face face-remapping-alist))))
+           (if remap
+               (company--face-attribute remap attr)
+             (face-attribute face attr nil t))))
+        ((keywordp (car-safe face))
+         (or (plist-get face attr)
+             (company--face-attribute (plist-get face :inherit))))
+        ((listp face)
+         (cl-find-if #'stringp
+                     (mapcar (lambda (f) (company--face-attribute f attr))
+                             face)))))
+
 (defun company--replacement-string (lines old column nl &optional align-top)
   (cl-decf column company-tooltip-margin)
 
@@ -2782,7 +2798,7 @@ If SHOW-VERSION is non-nil, show the version in the echo 
area."
     (let* ((nl-face (list
                      :extend t
                      :inverse-video nil
-                     :background (face-attribute 'default :background)))
+                     :background (company--face-attribute 'default 
:background)))
            (str (apply #'concat
                        (when nl " \n")
                        (cl-mapcan



reply via email to

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