branch: externals/ivy-hydra
commit 0f4cb44c5723564220d6faa8b6977f5a2044fd77
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy.el (ivy-add-prompt-count): Account for :dynamic-collection returning 0
Re emacs-lsp/lsp-ivy#5
---
ivy.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ivy.el b/ivy.el
index 5626023..343ba77 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2365,7 +2365,10 @@ This is useful for recursive `ivy-read'."
(error
"`ivy-count-format' can't be nil. Set it to \"\" instead"))
((string-match "%d.*\\(%d\\)" ivy-count-format)
- (let* ((w (1+ (floor (log (max 1 (length ivy--all-candidates)) 10))))
+ (let* ((w
+ (if (listp ivy--all-candidates)
+ (1+ (floor (log (max 1 (length ivy--all-candidates))
10)))
+ 1))
(s (replace-match (format "%%-%dd" w) t t ivy-count-format 1)))
(string-match "%d" s)
(concat (replace-match (format "%%%dd" w) t t s)