[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/popup 5374e55 110/184: Merge pull request #73 from auto-co
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/popup 5374e55 110/184: Merge pull request #73 from auto-complete/add-initial-index-test |
Date: |
Wed, 6 Oct 2021 00:01:22 -0400 (EDT) |
branch: elpa/popup
commit 5374e55822c53dbca818968dd492b5672c6da683
Merge: bb51a53 487c0a8
Author: Syohei YOSHIDA <syohex@gmail.com>
Commit: Syohei YOSHIDA <syohex@gmail.com>
Merge pull request #73 from auto-complete/add-initial-index-test
Add initial index test
---
popup.el | 20 ++++++++++----------
tests/popup-test.el | 17 +++++++++++++++++
2 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/popup.el b/popup.el
index cb3ad0b..c79b7ff 100644
--- a/popup.el
+++ b/popup.el
@@ -160,10 +160,10 @@ untouched."
(setq window (selected-window)))
(unless (popup-window-full-width-p window)
(let ((t-p-w-w (buffer-local-value 'truncate-partial-width-windows
- (window-buffer window))))
+ (window-buffer window))))
(if (integerp t-p-w-w)
- (< (window-width window) t-p-w-w)
- t-p-w-w))))
+ (< (window-width window) t-p-w-w)
+ t-p-w-w))))
(defun popup-current-physical-column ()
"Return the current physical column."
@@ -596,7 +596,7 @@ KEYMAP is a keymap that will be put on the popup contents."
(let (overlay begin w (dangle t) (prefix "") (postfix ""))
(when around
(popup-vertical-motion column direction))
- (setq around t
+ (setq around t
current-column (popup-current-physical-column))
(when (> current-column column)
@@ -627,8 +627,8 @@ KEYMAP is a keymap that will be put on the popup contents."
(overlay-put overlay 'postfix postfix)
(overlay-put overlay 'width width)
(aset overlays
- (if (> direction 0) i (- height i 1))
- overlay)))
+ (if (> direction 0) i (- height i 1))
+ overlay)))
(cl-loop for p from (- 10000 (* depth 1000))
for overlay in (nreverse (append overlays nil))
do (overlay-put overlay 'priority p))
@@ -1317,7 +1317,7 @@ PROMPT is a prompt string when reading events during
event loop."
(isearch-cursor-color popup-isearch-cursor-color)
(isearch-keymap popup-isearch-keymap)
isearch-callback
- initial-index
+ initial-index
&aux menu event)
"Show a popup menu of LIST at POINT. This function returns a
value of the selected item. Almost arguments are same as
@@ -1382,9 +1382,9 @@ If `INITIAL-INDEX' is non-nil, this is an initial index
value for
(if cursor
(popup-jump menu cursor)
(popup-draw menu))
- (when initial-index
- (popup-select menu
- (min (- (length list) 1) initial-index)))
+ (when initial-index
+ (popup-select menu
+ (min (- (length list) 1) initial-index)))
(if nowait
menu
(popup-menu-event-loop menu keymap fallback
diff --git a/tests/popup-test.el b/tests/popup-test.el
index 9153117..bfc19c7 100644
--- a/tests/popup-test.el
+++ b/tests/popup-test.el
@@ -618,6 +618,23 @@ Qux" :nowait t)
;; Qux"))
))
+(ert-deftest popup-test-initial-index ()
+ (popup-test-with-common-setup
+ (setq popup (popup-menu* '("Foo" "Bar" "Baz") :initial-index 0 :nowait t))
+ (should (popup-test-helper-popup-selected-item "Foo")))
+
+ (popup-test-with-common-setup
+ (setq popup (popup-menu* '("Foo" "Bar" "Baz") :initial-index 2 :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")))
+
+ (popup-test-with-common-setup
+ (setq popup (popup-menu* '("Foo" "Bar" "Baz") :initial-index 100 :nowait
t))
+ (should (popup-test-helper-popup-selected-item "Baz"))))
+
(defun popup-test-helper-input (key)
(push key unread-command-events))
- [nongnu] elpa/popup c0937ea 053/184: Truncate summary first, then string itself, (continued)
- [nongnu] elpa/popup c0937ea 053/184: Truncate summary first, then string itself, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup a49ffd0 081/184: Rename :initial-cursor keyword option to :cursor., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 5809969 041/184: Add test case for margin, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup e5794f8 052/184: Truncate summary when it is too long, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 967cde1 067/184: Merge pull request #30 from tkf/summary-face, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup e164f3b 098/184: fixed without ignore-errors, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 34be113 116/184: Merge pull request #78 from aki2o/fix-popup-delete, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup dcc9ee5 119/184: Merge pull request #80 from ancane/master, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 0bead7c 086/184: Use cl-lib functions instead of cl in tests, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 29c6db4 130/184: Pass filtering function as an argument to popup-menu*, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 5374e55 110/184: Merge pull request #73 from auto-complete/add-initial-index-test,
ELPA Syncer <=
- [nongnu] elpa/popup 47008e1 135/184: Allow the user to specify a custom function to build the regexp in isearch, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 3d62f15 161/184: Merge pull request #112 from PuercoWork/patch-1, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup cf2cefe 166/184: Fixed compile warning, free variable from display line numbers., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 51f4430 171/184: Fixed to not use emacs 26.1 as dep., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 28762fc 138/184: Improve definition, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 88efff5 010/184: Not to insert newlines., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup bb4bb26 019/184: git mv popup-test.el tests/popup-interactive-test.el, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 07901c6 023/184: Merge pull request #15 from tkf/travis-ci, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 31779da 028/184: Fix test case bug when batch mode., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 4a31175 033/184: Split setup macro to support extra setup, ELPA Syncer, 2021/10/06