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

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

[elpa] master 8ec972b 17/38: Defer company-reformat a little


From: Dmitry Gutov
Subject: [elpa] master 8ec972b 17/38: Defer company-reformat a little
Date: Sat, 25 Jul 2020 19:51:14 -0400 (EDT)

branch: master
commit 8ec972bcb61136e5262542d191c1f6907662ca77
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    Defer company-reformat a little
    
    Closes #962
---
 company.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/company.el b/company.el
index 34f90de..75836b6 100644
--- a/company.el
+++ b/company.el
@@ -1146,7 +1146,8 @@ can retrieve meta-data for them."
   ;; It's mory efficient to fix it only when they are displayed.
   ;; FIXME: Adopt the current text's capitalization instead?
   (if (eq (company-call-backend 'ignore-case) 'keep-prefix)
-      (concat company-prefix (substring candidate (length company-prefix)))
+      (let ((prefix (company--clean-string company-prefix)))
+        (concat prefix (substring candidate (length prefix))))
     candidate))
 
 (defun company--should-complete ()
@@ -2527,7 +2528,7 @@ If SHOW-VERSION is non-nil, show the version in the echo 
area."
                      (if company-common
                          (string-width company-common)
                        0)))
-         (_ (setq value (company--pre-render value)
+         (_ (setq value (company-reformat (company--pre-render value))
                   annotation (and annotation (company--pre-render annotation 
t))))
          (ann-ralign company-tooltip-align-annotations)
          (ann-truncate (< width
@@ -2788,7 +2789,7 @@ If SHOW-VERSION is non-nil, show the version in the echo 
area."
     (dotimes (_ len)
       (let* ((value (pop lines-copy))
              (annotation (company-call-backend 'annotation value)))
-        (setq value (company--clean-string (company-reformat value)))
+        (setq value (company--clean-string value))
         (when annotation
           (setq annotation (company--clean-string annotation))
           (when company-tooltip-align-annotations
@@ -3165,7 +3166,7 @@ Delay is determined by `company-tooltip-idle-delay'."
         comp msg)
 
     (while candidates
-      (setq comp (company-reformat (pop candidates))
+      (setq comp (company-reformat (company--clean-string (pop candidates)))
             len (+ len 1 (length comp)))
       (if (< i 10)
           ;; Add number.
@@ -3174,10 +3175,10 @@ Delay is determined by `company-tooltip-idle-delay'."
                                    'face 'company-echo))
             (cl-incf len 3)
             (cl-incf i)
-            (add-text-properties 3 (+ 3 (length company-common))
+            (add-text-properties 3 (+ 3 (string-width company-common))
                                  '(face company-echo-common) comp))
         (setq comp (propertize comp 'face 'company-echo))
-        (add-text-properties 0 (length company-common)
+        (add-text-properties 0 (string-width company-common)
                              '(face company-echo-common) comp))
       (if (>= len limit)
           (setq candidates nil)



reply via email to

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