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

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

[elpa] master 2191bdb 54/67: ivy.el (ivy-completions): Simplify


From: Oleh Krehel
Subject: [elpa] master 2191bdb 54/67: ivy.el (ivy-completions): Simplify
Date: Sun, 22 Mar 2015 17:34:09 +0000

branch: master
commit 2191bdb41a0cc0f45c1f2710208d73b82e9e386e
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy.el (ivy-completions): Simplify
---
 ivy.el |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/ivy.el b/ivy.el
index 25d8a70..34f7ad8 100644
--- a/ivy.el
+++ b/ivy.el
@@ -362,19 +362,12 @@ CANDIDATES is a list of strings."
       (setq ivy--index (max (1- ivy--length) 0)))
     (if (null cands)
         ""
-      (let ((index ivy--index))
-        (if (< index (/ ivy-height 2))
-            (setq cands
-                  (cl-subseq cands 0 (min (1- ivy-height) ivy--length)))
-          (setq cands
-                (cl-subseq cands
-                           (- index (/ ivy-height 2))
-                           (min (+ index (/ ivy-height 2))
-                                ivy--length)))
-          (setq index (min (/ ivy-height 2)
-                           (1- (length cands)))))
-        (setq ivy--current (copy-sequence
-                            (nth index cands)))
+      (let* ((half-height (/ ivy-height 2))
+             (start (max 0 (- ivy--index half-height)))
+             (end (min (+ start (1- ivy-height)) ivy--length))
+             (cands (cl-subseq cands start end))
+             (index (min ivy--index half-height (1- (length cands)))))
+        (setq ivy--current (copy-sequence (nth index cands)))
         (setf (nth index cands)
               (ivy--add-face ivy--current 'ivy-current-match))
         (concat "\n" (mapconcat



reply via email to

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