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

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

[elpa] externals/company f6b7bc5c35 10/24: Add handling of buffer-invisi


From: ELPA Syncer
Subject: [elpa] externals/company f6b7bc5c35 10/24: Add handling of buffer-invisibility-spec to company-safe-pixel-substring
Date: Mon, 6 Nov 2023 09:57:37 -0500 (EST)

branch: externals/company
commit f6b7bc5c352fed312250f6725700b238c1ea9e28
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    Add handling of buffer-invisibility-spec to company-safe-pixel-substring
    
    #1388
---
 company.el              | 13 +++++++++++++
 test/frontends-tests.el |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/company.el b/company.el
index 21ccb33d8b..8c913cff67 100644
--- a/company.el
+++ b/company.el
@@ -2826,6 +2826,19 @@ from the candidates list.")
         spw-from spw-to
         spw-from-prev
         front back)
+    (when buffer-invisibility-spec
+      (let ((fi 0) (ti 0))
+        (while (<= fi from-chars)
+          (when (and (< from-chars lstr)
+                     (get-text-property fi 'invisible str))
+            (cl-incf from-chars))
+          (cl-incf fi))
+        (when to-chars
+          (while (<= ti to-chars)
+            (when (and (< to-chars lstr)
+                       (get-text-property ti 'invisible str))
+              (cl-incf to-chars))
+            (cl-incf ti)))))
     (when (> from-chars lstr)
       (setq from-chars lstr))
     (while (>
diff --git a/test/frontends-tests.el b/test/frontends-tests.el
index 0055aed141..3b36e232f3 100644
--- a/test/frontends-tests.el
+++ b/test/frontends-tests.el
@@ -490,7 +490,7 @@
         (buffer-invisibility-spec '((outline . t) t)))
     (put-text-property 1 2 'invisible 'foo str)
     (should (equal
-             (company-modify-line str "zz" 4)
+             (company-modify-line str "zz" (* 3 (frame-char-width)))
              "-*-fzzbar"))))
 
 (ert-deftest company-scrollbar-bounds ()



reply via email to

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