[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 607fd1f 061/167: Bring back the lost perfect match logic
From: |
Oleh Krehel |
Subject: |
[elpa] master 607fd1f 061/167: Bring back the lost perfect match logic |
Date: |
Tue, 08 Dec 2015 10:49:54 +0000 |
branch: master
commit 607fd1f6bed0dfd5bdfe65ee11f33fa8aac683d2
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Bring back the lost perfect match logic
* ivy.el (ivy--recompute-index): Don't defer the perfect match logic to
`ivy-index-functions-alist'.
(ivy-recompute-index-swiper): Simplify.
Once again, if the minibuffer text becomes `equal' to one of the
candidates, that candidate will be selected.
Fixes #270
---
ivy.el | 46 +++++++++++++++++++++++-----------------------
1 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/ivy.el b/ivy.el
index f985ef7..1cbaaf7 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1657,13 +1657,24 @@ CANDIDATES are assumed to be static."
(cdr (assoc t ivy-index-functions-alist))
#'ivy-recompute-index-zero)))
(setq ivy--index
- (or (and (not (string= name ""))
- (not (and (require 'flx nil 'noerror)
- (eq ivy--regex-function 'ivy--regex-fuzzy)
- (< (length cands) 200)))
- (cl-position (nth ivy--index ivy--old-cands)
- cands))
- (funcall func re-str cands)))
+ (or
+ (cl-position (if (and (> (length re-str) 0)
+ (eq ?^ (aref re-str 0)))
+ (substring re-str 1)
+ re-str) cands
+ :test #'equal)
+ (and ivy--directory
+ (cl-position
+ (concat re-str "/") cands
+ :test #'equal))
+ (and (not (string= name ""))
+ (not (and (require 'flx nil 'noerror)
+ (eq ivy--regex-function 'ivy--regex-fuzzy)
+ (< (length cands) 200)))
+
+ (cl-position (nth ivy--index ivy--old-cands)
+ cands))
+ (funcall func re-str cands)))
(when (and (or (string= name "")
(string= name "^"))
(not (equal ivy--old-re "")))
@@ -1679,22 +1690,11 @@ CANDIDATES are assumed to be static."
(let ((tail (nthcdr ivy--index ivy--old-cands))
idx)
(if (and tail ivy--old-cands (not (equal "^" ivy--old-re)))
- (or (and (not (equal re-str ivy--old-re))
- (or
- (cl-position (if (and (> (length re-str) 0)
- (eq ?^ (aref re-str 0)))
- (substring re-str 1)
- re-str) cands
- :test #'equal)
- (and ivy--directory
- (cl-position
- (concat re-str "/") cands
- :test #'equal))))
- (progn
- (while (and tail (null idx))
- ;; Compare with eq to handle equal duplicates in cands
- (setq idx (cl-position (pop tail) cands)))
- (or idx 0)))
+ (progn
+ (while (and tail (null idx))
+ ;; Compare with eq to handle equal duplicates in cands
+ (setq idx (cl-position (pop tail) cands)))
+ (or idx 0))
ivy--index)))
(defun ivy-recompute-index-zero (_re-str _cands)
- [elpa] master c99956a 047/167: Fix window selection in counsel-locate, (continued)
- [elpa] master c99956a 047/167: Fix window selection in counsel-locate, Oleh Krehel, 2015/12/08
- [elpa] master fa0d04c 038/167: Move setq ivy--index to ivy--recompute-index, Oleh Krehel, 2015/12/08
- [elpa] master e5105ef 054/167: Don't re-anchor to matching old candidate if flx is on, Oleh Krehel, 2015/12/08
- [elpa] master f4bd3a4 055/167: counsel.el (counsel-ag): Add initial-directory, Oleh Krehel, 2015/12/08
- [elpa] master 79924dc 051/167: swiper.el (swiper--re-builder): Fix "^a" -> "^" case, Oleh Krehel, 2015/12/08
- [elpa] master 2404db1 053/167: Add feedback for long-running async processes, Oleh Krehel, 2015/12/08
- [elpa] master d4d53d8 059/167: ivy.el (ivy-partial): Fix for fuzzy completion, Oleh Krehel, 2015/12/08
- [elpa] master 2ae7d74 058/167: Fix the count in user-specified counsel-git-grep, Oleh Krehel, 2015/12/08
- [elpa] master fd19ab1 062/167: Add a test for the perfect match logic, Oleh Krehel, 2015/12/08
- [elpa] master 2386277 060/167: ivy.el (ivy-resume): Pass caller, Oleh Krehel, 2015/12/08
- [elpa] master 607fd1f 061/167: Bring back the lost perfect match logic,
Oleh Krehel <=
- [elpa] master f0acebd 063/167: Fix Custom menus, Oleh Krehel, 2015/12/08
- [elpa] master f6dd9cd 066/167: ivy.el (ivy-alt-done): Fix up last commit, Oleh Krehel, 2015/12/08
- [elpa] master a11c978 068/167: ivy-immediate-done should use ivy--directory, Oleh Krehel, 2015/12/08
- [elpa] master d8673f8 078/167: ivy.el (ffap): Move require, Oleh Krehel, 2015/12/08
- [elpa] master 47f53b6 073/167: counsel.el (counsel--find-symbol): Resolve name clash better, Oleh Krehel, 2015/12/08
- [elpa] master dc84ba3 070/167: Rename and move the minibuffer faces, Oleh Krehel, 2015/12/08
- [elpa] master 183b803 071/167: Use a specific blending method for dark themes, Oleh Krehel, 2015/12/08
- [elpa] master f9ef307 072/167: Improve the preselect index in ivy-resume, Oleh Krehel, 2015/12/08
- [elpa] master 576563d 082/167: ivy.el (with-ivy-window): Ensure window is live, Oleh Krehel, 2015/12/08
- [elpa] master f60d10e 075/167: "C-x C-f M-n" can call ffap-url-fetcher when at URL, Oleh Krehel, 2015/12/08