]> code.delx.au - gnu-emacs-elpa/commitdiff
Improve flx highlighting
authorOleh Krehel <ohwoeowho@gmail.com>
Wed, 6 Jan 2016 11:31:01 +0000 (12:31 +0100)
committerOleh Krehel <ohwoeowho@gmail.com>
Wed, 6 Jan 2016 11:31:01 +0000 (12:31 +0100)
* ivy.el (ivy--flx-sort): Highlight continuous characters with same
  face.

ivy.el

diff --git a/ivy.el b/ivy.el
index 2601647498de9b51b85c3729fc43a971718f735a..01126d92b43c5308394139b33f51ac01ca0b7f36 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -2004,14 +2004,17 @@ Prefix matches to NAME are put ahead of the list."
             (if cands-with-score
                 (mapcar (lambda (x)
                           (let ((str (copy-sequence (cdr x)))
-                                (i 1))
+                                (i 0)
+                                (last-j -2))
                             (dolist (j (cdar x))
+                              (unless (eq j (1+ last-j))
+                                (cl-incf i))
+                              (setq last-j j)
                               (ivy-add-face-text-property
                                j (1+ j)
                                (nth (1+ (mod (+ i 2) (1- (length ivy-minibuffer-faces))))
                                     ivy-minibuffer-faces)
-                               str)
-                              (cl-incf i))
+                               str))
                             str))
                         (sort cands-with-score
                               (lambda (x y)