[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master f29207f 324/399: Add ability to resume dynamic collections
From: |
Oleh Krehel |
Subject: |
[elpa] master f29207f 324/399: Add ability to resume dynamic collections |
Date: |
Sat, 20 Jul 2019 14:57:49 -0400 (EDT) |
branch: master
commit f29207f6c06315b3a679e9c8900f1dd78b3587cd
Author: Ruin0x11 <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add ability to resume dynamic collections
If `dynamic-collection' is set, Ivy will wait until the first chunk of
candidates has been received before selecting the preselected
candidate.
Fixes #1095
Fixes #2112
---
ivy.el | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/ivy.el b/ivy.el
index a7f1a66..90be1e3 100644
--- a/ivy.el
+++ b/ivy.el
@@ -600,6 +600,12 @@ Either a string or a list for `ivy-re-match'.")
(defvar ivy--old-text ""
"Store old `ivy-text' for dynamic completion.")
+(defvar ivy--trying-to-resume-dynamic-collection nil
+ "Non-nil if resuming from a dynamic collection.
+When non-nil, ivy will wait until the first chunk of asynchronous
+candidates has been received before selecting the last
+preselected candidate.")
+
(defcustom ivy-case-fold-search-default
(if search-upper-case
'auto
@@ -2179,13 +2185,16 @@ This is useful for recursive `ivy-read'."
(setq coll (ivy--set-candidates coll))
(setq ivy--old-re nil)
(setq ivy--old-cands nil)
- (when (integerp preselect)
- (setq ivy--old-re "")
- (ivy-set-index preselect))
(when initial-input
;; Needed for anchor to work
(setq ivy--old-cands coll)
(setq ivy--old-cands (ivy--filter initial-input coll)))
+ (setq ivy--trying-to-resume-dynamic-collection
+ (and preselect dynamic-collection))
+ (when (and (integerp preselect)
+ (not ivy--trying-to-resume-dynamic-collection))
+ (setq ivy--old-re "")
+ (ivy-set-index preselect))
(setq ivy--all-candidates coll)
(unless (integerp preselect)
(ivy-set-index (or
@@ -2994,6 +3003,11 @@ Should be run via minibuffer `post-command-hook'."
(setq ivy--old-text ivy-text)))
(when (or ivy--all-candidates
(not (get-process " *counsel*")))
+ (when ivy--trying-to-resume-dynamic-collection
+ (when-let* ((preselect (ivy-state-preselect ivy-last))
+ (preselect-index (ivy--preselect-index preselect
ivy--all-candidates)))
+ (ivy-set-index preselect-index))
+ (setq ivy--trying-to-resume-dynamic-collection nil))
(ivy--insert-minibuffer
(ivy--format ivy--all-candidates))))
(cond (ivy--directory
- [elpa] master f0a2341 337/399: counsel.el (counsel-rhythmbox): Add :require-match, (continued)
- [elpa] master f0a2341 337/399: counsel.el (counsel-rhythmbox): Add :require-match, Oleh Krehel, 2019/07/20
- [elpa] master 4de54f1 340/399: ivy.el (ivy-reverse-i-search-kill): Add and bind to "C-k", Oleh Krehel, 2019/07/20
- [elpa] master 7201c0f 334/399: ivy-hydra.el (ivy-dispatching-done-hydra-exit-keys): Extract, Oleh Krehel, 2019/07/20
- [elpa] master 935603e 310/399: ivy.el (ivy--done): Press "RET" or "C-m" to create a directory, Oleh Krehel, 2019/07/20
- [elpa] master a20c196 336/399: counsel.el (counsel-set-variable): Better annotations for options, Oleh Krehel, 2019/07/20
- [elpa] master cea24b7 339/399: counsel.el (counsel-expression-history): Remove obsolete command, Oleh Krehel, 2019/07/20
- [elpa] master 9f6141f 345/399: counsel.el (counsel--browse-history): Allow to remove elements with "C-k", Oleh Krehel, 2019/07/20
- [elpa] master 673c45e 342/399: ivy.el (ivy--minibuffer-setup): Set line-spacing to nil in the minibuffer, Oleh Krehel, 2019/07/20
- [elpa] master 8d7578f 346/399: counsel.el (counsel--browse-history): Better prompt, Oleh Krehel, 2019/07/20
- [elpa] master f9e8116 344/399: swiper.el (swiper-isearch-action): Fix outlines getting over-revealed, Oleh Krehel, 2019/07/20
- [elpa] master f29207f 324/399: Add ability to resume dynamic collections,
Oleh Krehel <=
- [elpa] master 3b1a25b 331/399: ivy-test.el (counsel-find-file-with-dotfiles): Fix, Oleh Krehel, 2019/07/20
- [elpa] master 8fc254f 341/399: counsel.el (counsel--setq-doconst): Fix compiler warning, Oleh Krehel, 2019/07/20
- [elpa] master 1c436f6 347/399: ivy.el (ivy-reverse-i-search): Don't call another ivy-reverse-i-search, Oleh Krehel, 2019/07/20
- [elpa] master 975c2af 348/399: ivy.el (ivy-reverse-i-search): Error when called from top-level, Oleh Krehel, 2019/07/20
- [elpa] master 888b417 350/399: ivy.el (ivy--recompute-index-inhibit): Add, Oleh Krehel, 2019/07/20
- [elpa] master 4c9c14a 356/399: ivy.el (ivy--minibuffer-cleanup): Rename from ivy--cleanup, Oleh Krehel, 2019/07/20
- [elpa] master 4324211 354/399: ivy.el (ivy-read): Factor out transformer-fn, Oleh Krehel, 2019/07/20
- [elpa] master d52c176 351/399: ivy.el (ivy-switch-buffer-kill): Move from "C-c C-k" to "C-k", Oleh Krehel, 2019/07/20
- [elpa] master 7925637 353/399: ivy.el (ivy--compute-extra-candidates): Extract, Oleh Krehel, 2019/07/20
- [elpa] master f6876a7 359/399: ivy.el (ivy-read): Simplify, Oleh Krehel, 2019/07/20