[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 3699fa9 041/167: Don't reset the match to first if the cur
From: |
Oleh Krehel |
Subject: |
[elpa] master 3699fa9 041/167: Don't reset the match to first if the current one still works |
Date: |
Tue, 08 Dec 2015 10:49:47 +0000 |
branch: master
commit 3699fa9b416ba129c448cb60a1eb016d3a820ee9
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Don't reset the match to first if the current one still works
* ivy.el (ivy--recompute-index): If the old match is still located in
the current matches after the change in input, keep it selected.
* ivy-test.el (ivy-read): Add test.
Fixes #258
---
ivy-test.el | 6 +++++-
ivy.el | 5 ++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/ivy-test.el b/ivy-test.el
index 384cd4d..5c77394 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -68,7 +68,11 @@
(ivy-with '(let ((ivy-re-builders-alist '((t . ivy--regex-fuzzy))))
(ivy-read "pattern: " '("package-list-packages"
"something-else")))
"plp C-m")
- "package-list-packages")))
+ "package-list-packages"))
+ (should (equal
+ (ivy-with '(ivy-read "test" '("aaab" "aaac"))
+ "a C-n <tab> C-m")
+ "aaac")))
(ert-deftest swiper--re-builder ()
(setq swiper--width 4)
diff --git a/ivy.el b/ivy.el
index 02b6c73..235aca7 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1612,7 +1612,10 @@ CANDIDATES are assumed to be static."
(func (or (and caller (cdr (assoc caller ivy-index-functions-alist)))
(cdr (assoc t ivy-index-functions-alist))
#'ivy-recompute-index-zero)))
- (setq ivy--index (funcall func re-str cands))
+ (setq ivy--index
+ (or (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 "")))
- [elpa] master 47a220d 023/167: Support hash tables in ivy-read, (continued)
- [elpa] master 47a220d 023/167: Support hash tables in ivy-read, Oleh Krehel, 2015/12/08
- [elpa] master 21b9edf 021/167: Fix up visual-line-mode limitation logic, Oleh Krehel, 2015/12/08
- [elpa] master 126158d 025/167: ivy.el (ivy--filter): Anchor only for swiper, Oleh Krehel, 2015/12/08
- [elpa] master 800e640 028/167: Fix "M-o k" when switching buffers, Oleh Krehel, 2015/12/08
- [elpa] master b9d0502 026/167: ivy.el (ivy--filter): Fix typo, Oleh Krehel, 2015/12/08
- [elpa] master 6956311 027/167: Adjust ivy-state-preselect for file name completion, Oleh Krehel, 2015/12/08
- [elpa] master 6f4d46b 034/167: Fix preselect for input "^", Oleh Krehel, 2015/12/08
- [elpa] master ef189f1 030/167: ivy.el (ivy-count-format): Extend customize choices, Oleh Krehel, 2015/12/08
- [elpa] master e722d6a 046/167: swiper.el (swiper-mc): Add and bind to "C-7", Oleh Krehel, 2015/12/08
- [elpa] master 3a3b052 036/167: swiper.el: Add a lot of avy declares, Oleh Krehel, 2015/12/08
- [elpa] master 3699fa9 041/167: Don't reset the match to first if the current one still works,
Oleh Krehel <=
- [elpa] master 877648a 045/167: ivy.el (ivy-case-fold-search): New defvar, Oleh Krehel, 2015/12/08
- [elpa] master 340318d 044/167: ivy-count-format must be an empty string instead of nil, Oleh Krehel, 2015/12/08
- [elpa] master 9cc75eb 050/167: Adjust the swiper regexp builder for the display change, Oleh Krehel, 2015/12/08
- [elpa] master 85682ee 048/167: Fix "C-x h" selection and "C-b" bug, Oleh Krehel, 2015/12/08
- [elpa] master 99698e6 035/167: ivy.el (ivy-dispatching-call): Add and bind to "C-M-o", Oleh Krehel, 2015/12/08
- [elpa] master 0630395 043/167: Fix the count when git-grep for "->foo", Oleh Krehel, 2015/12/08
- [elpa] master 4045349 032/167: ivy.el (ivy-use-virtual-buffers): Update docstring, Oleh Krehel, 2015/12/08
- [elpa] master f9df75e 037/167: ivy.el (ivy-index-functions-alist): New variable, Oleh Krehel, 2015/12/08
- [elpa] master 6e3c692 029/167: Fix ivy-state-preselect for file name completion, Oleh Krehel, 2015/12/08
- [elpa] master c69b4b6 033/167: ivy.el (ivy-last): Update docstring, Oleh Krehel, 2015/12/08