diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2015-05-04 09:09:10 +0200 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2015-05-04 09:09:10 +0200 |
commit | e928ba51ae2850df71bc1be05471a980ec0b531e (patch) | |
tree | 6508e5d0c0d2f44eead7d46363711502a842d09e /helm-dabbrev.el | |
parent | 4d6d8b0eb8824f0c1b7614c33325675ab9c1675d (diff) |
Avoid cycling forever when only one candidate.
* helm-dabbrev.el (helm-dabbrev): Do it.
Diffstat (limited to 'helm-dabbrev.el')
-rw-r--r-- | helm-dabbrev.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/helm-dabbrev.el b/helm-dabbrev.el index 57c80b9d..a00d2d45 100644 --- a/helm-dabbrev.el +++ b/helm-dabbrev.el @@ -312,6 +312,14 @@ but the initial search for all candidates in buffer(s)." ;; Move already tried candidates to end of list. (setq helm-dabbrev--cache (append (remove it helm-dabbrev--cache) (list it)))) + ;; When there is only one candidate in cache + ;; and the iterator have been consumed, no need + ;; to reset dabbrev, which will have for effect + ;; to reinitialize an iterator of one candidate + ;; and reinsert the same thing which is already inserted infinitely. + (when (and (null (cdr helm-dabbrev--cache)) + (string= (car helm-dabbrev--cache) dabbrev)) + (setq cycling-disabled-p t)) (unless cycling-disabled-p (delete-region (car limits) (point)) (setq dabbrev (helm-dabbrev-info-dabbrev helm-dabbrev--data) |