[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 1a5b259 44/90: Fix the minibuffer being too small with eno
From: |
Oleh Krehel |
Subject: |
[elpa] master 1a5b259 44/90: Fix the minibuffer being too small with enough candidates |
Date: |
Tue, 30 Jun 2015 07:28:25 +0000 |
branch: master
commit 1a5b259ba40f0439320b15c896b57b74fdd54de9
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Fix the minibuffer being too small with enough candidates
* ivy.el (ivy--format): Fix the bug of getting the minibuffer height
less than `ivy-height' when `ivy--index' was between `ivy--length'
and (- ivy--length (/ ivy--height 2)).
* ivy-test.el (ivy--format): Add test.
---
ivy-test.el | 19 +++++++++++++++++++
ivy.el | 3 ++-
2 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/ivy-test.el b/ivy-test.el
index 1062cd8..af0fc60 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -95,3 +95,22 @@
"^"))
(should (string= (ivy--regex-fuzzy "$")
"$")))
+
+(ert-deftest ivy--format ()
+ (should (string= (let ((ivy--index 10)
+ (ivy-format-function (lambda (x) (mapconcat
#'identity x "\n")))
+ (cands '("NAME"
+ "SYNOPSIS"
+ "DESCRIPTION"
+ "FUNCTION LETTERS"
+ "SWITCHES"
+ "DIAGNOSTICS"
+ "EXAMPLE 1"
+ "EXAMPLE 2"
+ "EXAMPLE 3"
+ "SEE ALSO"
+ "AUTHOR")))
+ (ivy--format cands))
+ #("\nDESCRIPTION\nFUNCTION
LETTERS\nSWITCHES\nDIAGNOSTICS\nEXAMPLE 1\nEXAMPLE 2\nEXAMPLE 3\nSEE
ALSO\nAUTHOR"
+ 0 90 (read-only nil)
+ 90 96 (face ivy-current-match read-only nil)))))
diff --git a/ivy.el b/ivy.el
index c812466..744abc7 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1233,8 +1233,9 @@ CANDS is a list of strings."
(let* ((half-height (/ ivy-height 2))
(start (max 0 (- ivy--index half-height)))
(end (min (+ start (1- ivy-height)) ivy--length))
+ (start (max 0 (min start (- end (1- ivy-height)))))
(cands (cl-subseq cands start end))
- (index (min ivy--index half-height (1- (length cands)))))
+ (index (- ivy--index start)))
(when ivy--directory
(setq cands (mapcar (lambda (x)
(if (string-match-p "/\\'" x)
- [elpa] master 7f2cc7c 33/90: counsel.el: Add a bunch of autoload cookies, (continued)
- [elpa] master 7f2cc7c 33/90: counsel.el: Add a bunch of autoload cookies, Oleh Krehel, 2015/06/30
- [elpa] master 165c176 34/90: counsel.el (counsel-find-file-ignore-regexp): Default to nil, Oleh Krehel, 2015/06/30
- [elpa] master 72d4c76 35/90: Replace "C-x 6" with "<f2>" in counsel-M-x, Oleh Krehel, 2015/06/30
- [elpa] master 8c3bf21 36/90: ivy-toggle-calling: Toggle calling "RET" action for current candidate, Oleh Krehel, 2015/06/30
- [elpa] master 39eb7ed 38/90: counsel.el (counsel-M-x): Call smex-initialize, Oleh Krehel, 2015/06/30
- [elpa] master 109e5b0 37/90: Bind "C-o" to hydra-ivy/body, Oleh Krehel, 2015/06/30
- [elpa] master 7dea8b7 39/90: ivy.el (hydra-ivy/body): Autoload, Oleh Krehel, 2015/06/30
- [elpa] master 9ceb7ee 42/90: Fix yank/undo bug, Oleh Krehel, 2015/06/30
- [elpa] master d8172a0 40/90: ivy.el (ivy--regex-fuzzy): Improve for "^" and "$", Oleh Krehel, 2015/06/30
- [elpa] master 02cedb7 43/90: ivy.el (ivy-insert-current): Add and bind to "M-i", Oleh Krehel, 2015/06/30
- [elpa] master 1a5b259 44/90: Fix the minibuffer being too small with enough candidates,
Oleh Krehel <=
- [elpa] master e334a75 45/90: ivy.el (ivy-initial-inputs-alist): Add man and woman, Oleh Krehel, 2015/06/30
- [elpa] master ae05765 41/90: Allow to customize the initial input for all commands, Oleh Krehel, 2015/06/30
- [elpa] master 4d66758 47/90: Allow to toggle matching mode with "C-o m", Oleh Krehel, 2015/06/30
- [elpa] master 16fefbc 48/90: ivy-hydra.el (hydra-ivy): Add "C-j" and "C-m" exit points, Oleh Krehel, 2015/06/30
- [elpa] master 7945ab0 49/90: counsel.el (counsel-M-x): Call smex-rank, Oleh Krehel, 2015/06/30
- [elpa] master 76897c0 46/90: ivy.el (ivy-sort-functions-alist): Work for commands as well, Oleh Krehel, 2015/06/30
- [elpa] master 61bb9e0 50/90: Require TRAMP in time, Oleh Krehel, 2015/06/30
- [elpa] master 9df660c 51/90: swiper.el (swiper-query-replace): Don't miss the first, Oleh Krehel, 2015/06/30
- [elpa] master d47dd9b 52/90: ivy-hydra.el: Improve for hydra not installed, Oleh Krehel, 2015/06/30
- [elpa] master 265f47d 53/90: Swiper should not deactivate-mark, Oleh Krehel, 2015/06/30