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

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

[elpa] externals/company a6a27340e3 08/24: company-safe-pixel-substring:


From: ELPA Syncer
Subject: [elpa] externals/company a6a27340e3 08/24: company-safe-pixel-substring: Handle characters near eol better
Date: Mon, 6 Nov 2023 09:57:37 -0500 (EST)

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

    company-safe-pixel-substring: Handle characters near eol better
    
    Previously, it could cut them off too eagerly, if the line contains wide 
chars.
    
    #1388
---
 company.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/company.el b/company.el
index 418c3c65c7..14631b269a 100644
--- a/company.el
+++ b/company.el
@@ -2823,19 +2823,21 @@ from the candidates list.")
         spw-from spw-to
         spw-from-prev
         front back)
-    (while (and (<= from-chars lstr)
-                (>
-                 (setq spw-from
-                       (company--string-pixel-width (substring str 0 
from-chars)))
-                 from))
+    (when (> from-chars lstr)
+      (setq from-chars lstr))
+    (while (>
+            (setq spw-from
+                  (company--string-pixel-width (substring str 0 from-chars)))
+            from)
       (setq spw-from-prev spw-from)
       (cl-decf from-chars))
     (if (>= from-chars lstr)
         (if to
             (propertize " " 'display `(space . (:width (,(- to from)))))
           "")
+      (when (and to-chars (> to-chars lstr))
+        (setq to-chars lstr))
       (while (and to
-                  (< to-chars lstr)
                   (>
                    (setq spw-to
                          (company--string-pixel-width (substring str 0 
to-chars)))



reply via email to

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