Format long help texts better in read-multiple-choice

* lisp/emacs-lisp/rmc.el (rmc--show-help): Format long help texts
better (bug#54430).
This commit is contained in:
Felician Nemeth 2022-03-17 12:44:43 +01:00 committed by Lars Ingebrigtsen
parent 7fef2e04b2
commit 6bbd1cc5c9
2 changed files with 32 additions and 4 deletions

View file

@ -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