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

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

[elpa] master 7280e19 050/348: ivy.el (ivy-completion-common-length): Fi


From: Oleh Krehel
Subject: [elpa] master 7280e19 050/348: ivy.el (ivy-completion-common-length): Fix double insert bug
Date: Sat, 8 Apr 2017 11:03:22 -0400 (EDT)

branch: master
commit 7280e19734be92d1a3b2921e1dc36f9eaf4766bb
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy.el (ivy-completion-common-length): Fix double insert bug
    
    The argument passed to `ivy-completion-common-length' looked like:
    
        ("js-indent-level"
         0 12 (font-lock-face
               completions-common-part)
         12 13 (font-lock-face
                completions-first-difference))
    
    Note the `font-lock-face' property instead of the `face' property that
    `ivy-completion-common-length' expected. The function now works with
    both types.
    
    Fixes #528
---
 ivy.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/ivy.el b/ivy.el
index c68390c..91c89e5 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1653,14 +1653,18 @@ The previous string is between `ivy-completion-beg' and 
`ivy-completion-end'."
 (defun ivy-completion-common-length (str)
   "Return the length of the first 'completions-common-part face in STR."
   (let ((pos 0)
-        (len (length str)))
+        (len (length str))
+        face-sym)
     (while (and (<= pos len)
-                (let ((prop (get-text-property pos 'face str)))
+                (let ((prop (or (prog1 (get-text-property pos 'face str)
+                                  (setq face-sym 'face))
+                                (prog1 (get-text-property pos 'font-lock-face 
str)
+                                  (setq face-sym 'font-lock-face)))))
                   (not (eq 'completions-common-part
                            (if (listp prop) (car prop) prop)))))
       (setq pos (1+ pos)))
     (if (< pos len)
-        (or (next-single-property-change pos 'face str) len)
+        (or (next-single-property-change pos face-sym str) len)
       0)))
 
 (defun ivy-completion-in-region (start end collection &optional predicate)



reply via email to

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