From 6bbd1cc5c9cd3db40dcb1ce82f478473b1f78131 Mon Sep 17 00:00:00 2001 From: Felician Nemeth Date: Thu, 17 Mar 2022 12:44:43 +0100 Subject: Format long help texts better in read-multiple-choice * lisp/emacs-lisp/rmc.el (rmc--show-help): Format long help texts better (bug#54430). --- test/lisp/emacs-lisp/rmc-tests.el | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'test/lisp/emacs-lisp') diff --git a/test/lisp/emacs-lisp/rmc-tests.el b/test/lisp/emacs-lisp/rmc-tests.el index c1c46d6400e..ed30d82c3b8 100644 --- a/test/lisp/emacs-lisp/rmc-tests.el +++ b/test/lisp/emacs-lisp/rmc-tests.el @@ -66,5 +66,27 @@ (should (equal (list char str) (read-multiple-choice "Do it? " '((?y "yes") (?n "no")))))))) -(provide 'rmc-tests) +(ert-deftest test-read-multiple-choice-help () + (let ((chars '(?o ?a)) + help) + (cl-letf* (((symbol-function #'read-event) + (lambda () + (message "chars %S" chars) + (when (= 1 (length chars)) + (with-current-buffer "*Multiple Choice Help*" + (setq help (buffer-string)))) + (pop chars)))) + (read-multiple-choice + "Choose:" + '((?a "aaa") + (?b "bbb") + (?c "ccc" "a really long description of ccc"))) + (should (equal help "Choose: + +a: [A]aa b: [B]bb c: [C]cc + a really long + description of ccc + \n?: [?] +"))))) + ;;; rmc-tests.el ends here -- cgit v1.2.3