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

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

[elpa] externals/company 277640481a 19/30: Render the "preview" overlay


From: ELPA Syncer
Subject: [elpa] externals/company 277640481a 19/30: Render the "preview" overlay over the matching suffix text
Date: Sat, 13 Jul 2024 00:57:51 -0400 (EDT)

branch: externals/company
commit 277640481a8dec0e341fa4b5dc833d79d5ad1183
Author: Dmitry Gutov <dmitry@gutov.dev>
Commit: Dmitry Gutov <dmitry@gutov.dev>

    Render the "preview" overlay over the matching suffix text
    
    Rather than cutting the overlay itself shorter.
    
    #1106 #340
---
 company.el | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/company.el b/company.el
index f35fb96131..a8b6416aae 100644
--- a/company.el
+++ b/company.el
@@ -4262,11 +4262,6 @@ Delay is determined by `company-tooltip-idle-delay'."
                          (company-strip-prefix completion prefix)
                        completion))
 
-    (setq completion (if (string-suffix-p suffix completion)
-                         (substring completion 0 (- (length completion)
-                                                    (length suffix)))
-                       completion))
-
     (when (string-prefix-p "\n" completion)
       (setq completion (concat (propertize " " 'face 'company-preview) "\n"
                                (substring completion 1))))
@@ -4280,17 +4275,21 @@ Delay is determined by `company-tooltip-idle-delay'."
            (ptf-workaround (and
                             pto
                             (char-before pos)
-                            (eq pos (overlay-start pto)))))
+                            (eq pos (overlay-start pto))))
+           (end pos))
       ;; Try to accommodate for the pseudo-tooltip overlay,
       ;; which may start at the same position if it's at eol.
       (when ptf-workaround
         (cl-decf beg)
         (setq completion (concat (buffer-substring beg pos) completion)))
 
-      (setq company-preview-overlay (make-overlay beg pos))
+      (when (string-suffix-p suffix completion)
+        (cl-incf end (length suffix)))
+
+      (setq company-preview-overlay (make-overlay beg end))
 
       (let ((ov company-preview-overlay))
-        (overlay-put ov (if ptf-workaround 'display 'after-string)
+        (overlay-put ov (if (> end beg) 'display 'after-string)
                      completion)
         (overlay-put ov 'window (selected-window))))))
 



reply via email to

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