branch: elpa/popup
commit 649242e948ae3b8efbdd9628bf42fbbe84fb731f
Author: Igor Shymko <[email protected]>
Commit: Igor Shymko <[email protected]>
:initial-index respects real popup height(beyond first popup page)
---
popup.el | 4 ++--
tests/popup-test.el | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/popup.el b/popup.el
index a478699..9287706 100644
--- a/popup.el
+++ b/popup.el
@@ -1384,8 +1384,8 @@ If `INITIAL-INDEX' is non-nil, this is an initial index
value for
(popup-jump menu cursor)
(popup-draw menu))
(when initial-index
- (popup-select menu
- (min (- (length list) 1) initial-index)))
+ (dotimes (counter (min (- (length list) 1) initial-index))
+ (popup-next menu)))
(if nowait
menu
(popup-menu-event-loop menu keymap fallback
diff --git a/tests/popup-test.el b/tests/popup-test.el
index bfc19c7..67d3aeb 100644
--- a/tests/popup-test.el
+++ b/tests/popup-test.el
@@ -628,6 +628,10 @@ Qux" :nowait t)
(should (popup-test-helper-popup-selected-item "Baz")))
(popup-test-with-common-setup
+ (setq popup (popup-menu* '("Foo" "Bar" "Baz") :initial-index 2 :height 1
:scroll-bar t :nowait t))
+ (should (popup-test-helper-popup-selected-item "Baz")))
+
+ (popup-test-with-common-setup
(setq popup (popup-menu* '("Foo" "Bar" "Baz") :initial-index -1 :nowait t))
(should (popup-test-helper-popup-selected-item "Foo")))