[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master c59752b 16/19: Update sorting order, make sure that perfec
From: |
Oleh Krehel |
Subject: |
[elpa] master c59752b 16/19: Update sorting order, make sure that perfect match is selected |
Date: |
Thu, 16 Apr 2015 12:18:14 +0000 |
branch: master
commit c59752b67ef952feb17b2fa2fcb520a53e8fde84
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Update sorting order, make sure that perfect match is selected
ivy.el (ivy-completions): Update.
When the regex matches perfectly, select it.
---
ivy.el | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/ivy.el b/ivy.el
index 3ac5931..0bb58fe 100644
--- a/ivy.el
+++ b/ivy.el
@@ -265,6 +265,7 @@ Turning on Ivy mode will set `completing-read-function' to
`ivy-completing-read'."
:group 'ivy
:global t
+ :lighter " ivy"
(if ivy-mode
(setq completing-read-function 'ivy-completing-read)
(setq completing-read-function 'completing-read-default)))
@@ -427,7 +428,6 @@ CANDIDATES is a list of strings."
(cands (if (and (equal re ivy--old-re)
ivy--old-cands)
ivy--old-cands
- (setq ivy--old-re re)
(ignore-errors
(cl-remove-if-not
(lambda (x) (string-match re x))
@@ -435,12 +435,15 @@ CANDIDATES is a list of strings."
(tail (nthcdr ivy--index ivy--old-cands))
(ww (window-width))
idx)
- (setq ivy--length (length cands))
(when (and tail ivy--old-cands)
- (while (and tail (null idx))
- ;; Compare with eq to handle equal duplicates in cands
- (setq idx (cl-position (pop tail) cands)))
- (setq ivy--index (or idx 0)))
+ (unless (and (not (equal re ivy--old-re))
+ (setq ivy--index (cl-position re cands :test 'equal)))
+ (while (and tail (null idx))
+ ;; Compare with eq to handle equal duplicates in cands
+ (setq idx (cl-position (pop tail) cands)))
+ (setq ivy--index (or idx 0))))
+ (setq ivy--old-re re)
+ (setq ivy--length (length cands))
(setq ivy--old-cands cands)
(when (>= ivy--index ivy--length)
(setq ivy--index (max (1- ivy--length) 0)))
- [elpa] master 49321c0 06/19: Allow duplicate candidates in `ivy-read', (continued)
- [elpa] master 49321c0 06/19: Allow duplicate candidates in `ivy-read', Oleh Krehel, 2015/04/16
- [elpa] master f72a860 11/19: counsel.el: Fixup prefixes, Oleh Krehel, 2015/04/16
- [elpa] master 841d59b 01/19: "C-s" should forward to "C-n" etc, Oleh Krehel, 2015/04/16
- [elpa] master 609577e 12/19: Fix invalid package header line, Oleh Krehel, 2015/04/16
- [elpa] master e816884 03/19: Default ARG to 1 for arrows, Oleh Krehel, 2015/04/16
- [elpa] master a8a1f65 02/19: Add numeric arguments to arrows, Oleh Krehel, 2015/04/16
- [elpa] master 0477214 08/19: Fix `ivy-backward-delete-char-function', Oleh Krehel, 2015/04/16
- [elpa] master 6dd1068 04/19: swiper.el (swiper-query-replace): Enable recursive minibuffers, Oleh Krehel, 2015/04/16
- [elpa] master 3b78e0e 18/19: swiper.el: Bump version, Oleh Krehel, 2015/04/16
- [elpa] master 22139ae 19/19: Merge commit '3b78e0e503f4763f8a2d77eeacfc91213ec5532e' from swiper, Oleh Krehel, 2015/04/16
- [elpa] master c59752b 16/19: Update sorting order, make sure that perfect match is selected,
Oleh Krehel <=
- [elpa] master 75aa14d 17/19: Fix thing-at-point in describe-function and -variable, Oleh Krehel, 2015/04/16
- [elpa] master 6a098c6 15/19: Add ivy-mode, Oleh Krehel, 2015/04/16
- [elpa] master 592b692 07/19: Add defcustom for ivy-backward-delete-char, Oleh Krehel, 2015/04/16
- [elpa] master 048f479 13/19: Add four more commands, Oleh Krehel, 2015/04/16
- [elpa] master be452cc 14/19: swiper.el (swiper-font-lock-ensure): Exclude org-agenda-mode, Oleh Krehel, 2015/04/16
- [elpa] master ba0590f 09/19: counsel.el: Update comments, Oleh Krehel, 2015/04/16