[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/company e1d5837 08/46: Use 'after-string' to render the
From: |
Dmitry Gutov |
Subject: |
[elpa] externals/company e1d5837 08/46: Use 'after-string' to render the popup |
Date: |
Wed, 30 Dec 2020 18:33:02 -0500 (EST) |
branch: externals/company
commit e1d58370cf1f6b42b929376eab2193bfc0914381
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
Use 'after-string' to render the popup
To make possible rendering images in it.
Discussion in
https://github.com/company-mode/company-mode/pull/996#issuecomment-662743347.
---
company.el | 34 +++++++++++++++++++++++-----------
1 file changed, 23 insertions(+), 11 deletions(-)
diff --git a/company.el b/company.el
index 45cfebf..82264e1 100644
--- a/company.el
+++ b/company.el
@@ -2738,9 +2738,23 @@ If SHOW-VERSION is non-nil, show the version in the echo
area."
(company--offset-line (pop lines) offset))
new))
- (let ((str (concat (when nl " \n")
- (mapconcat 'identity (nreverse new) "\n")
- "\n")))
+ ;; TODO: Choose the face most appropriate for each line, instead of
+ ;; simply forcing :extend to nil.
+ (let* ((nl-face (list
+ :extend t
+ :inverse-video nil
+ :background (face-attribute 'default :background)))
+ (str (concat (when nl " \n")
+ (apply
+ #'concat
+ (mapcan
+ ;;
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42552#23
+ (lambda (line) (list line
+ (propertize "\n" 'face nl-face)))
+ (nreverse new))))))
+ ;; Use add-face-text-property in Emacs 24.4
+ ;; https://debbugs.gnu.org/38563
+ (font-lock-append-text-property 0 (length str) 'face 'default str)
(when nl (put-text-property 0 1 'cursor t str))
str)))
@@ -2949,14 +2963,12 @@ Returns a negative number if the tooltip should be
displayed above point."
(overlay-put ov 'priority 111)
;; No (extra) prefix for the first line.
(overlay-put ov 'line-prefix "")
- ;; `display' is better
- ;; (http://debbugs.gnu.org/18285, http://debbugs.gnu.org/20847),
- ;; but it doesn't work on 0-length overlays.
- (if (< (overlay-start ov) (overlay-end ov))
- (overlay-put ov 'display disp)
- (overlay-put ov 'after-string disp)
- (overlay-put ov 'invisible t))
- (overlay-put ov 'face 'default)
+ (overlay-put ov 'after-string disp)
+ ;; `display' is better than `invisible':
+ ;; https://debbugs.gnu.org/18285
+ ;; https://debbugs.gnu.org/20847
+ ;; https://debbugs.gnu.org/42521
+ (overlay-put ov 'display "")
(overlay-put ov 'window (selected-window)))))
(defun company-pseudo-tooltip-guard ()
- [elpa] externals/company updated (24aefbd -> 123b604), Dmitry Gutov, 2020/12/30
- [elpa] externals/company 2158fbd 10/46: company-tooltip-width-grow-only: New option, Dmitry Gutov, 2020/12/30
- [elpa] externals/company c09e7ff 01/46: Remove unused variable, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 5eb7d86 07/46: Add some clarifications for the Customize interface, Dmitry Gutov, 2020/12/30
- [elpa] externals/company e1d5837 08/46: Use 'after-string' to render the popup,
Dmitry Gutov <=
- [elpa] externals/company be8cf44 09/46: Tidy up a little, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 9e153fa 12/46: Restore Emacs < 26 compatibility, Dmitry Gutov, 2020/12/30
- [elpa] externals/company e393785 13/46: Add a FIXME, Dmitry Gutov, 2020/12/30
- [elpa] externals/company ca231bf 04/46: Remove company-eclim, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 10d7ee5 06/46: Remove company-xcode, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 57a6554 11/46: company-clang--parse-output: Filter out duplicates, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 520978c 02/46: Change the replacement character for non-printables, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 1b985d1 03/46: Set project-vc-merge-submodules to nil [ci skip], Dmitry Gutov, 2020/12/30
- [elpa] externals/company 664dd19 05/46: Move company-clang to after company-capf, Dmitry Gutov, 2020/12/30
- [elpa] externals/company 54f60ef 14/46: Print the right buffer-local value, Dmitry Gutov, 2020/12/30