summaryrefslogtreecommitdiff
path: root/test/lisp/wid-edit-tests.el
diff options
context:
space:
mode:
authorMauro Aranda <maurooaranda@gmail.com>2021-01-04 10:02:20 -0300
committerMauro Aranda <maurooaranda@gmail.com>2021-01-04 10:02:20 -0300
commit4e80eb7b7ce76e02fa0b2b0fa66223f29e3f6bcd (patch)
treebcce0b8a668105eb84b8feb819294c1c42babaea /test/lisp/wid-edit-tests.el
parent65f21729e60f831026ce134b87561c5119b6a926 (diff)
downloademacs-4e80eb7b7ce76e02fa0b2b0fa66223f29e3f6bcd.tar.gz
emacs-4e80eb7b7ce76e02fa0b2b0fa66223f29e3f6bcd.tar.bz2
emacs-4e80eb7b7ce76e02fa0b2b0fa66223f29e3f6bcd.zip
Don't skip widgets when moving backward
* lisp/wid-edit.el (widget-move): Remove code that caused widget-backward to skip an immediate previous widget when moving backward from the start of a widget. (Bug#45623) * test/lisp/wid-edit-tests.el (widget-test-widget-backward): New test.
Diffstat (limited to 'test/lisp/wid-edit-tests.el')
-rw-r--r--test/lisp/wid-edit-tests.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/lisp/wid-edit-tests.el b/test/lisp/wid-edit-tests.el
index 35235c65665..17fdfefce84 100644
--- a/test/lisp/wid-edit-tests.el
+++ b/test/lisp/wid-edit-tests.el
@@ -301,4 +301,25 @@ return nil, even with a non-nil bubblep argument."
(should child)
(should (equal (widget-value widget) '((1 "One")))))))
+(ert-deftest widget-test-widget-move ()
+ "Test moving with `widget-forward' and `widget-backward'."
+ (with-temp-buffer
+ (dolist (el '("First" "Second" "Third"))
+ (widget-create 'push-button el))
+ (widget-insert "\n")
+ (use-local-map widget-keymap)
+ (widget-setup)
+ (goto-char (point-min))
+ ;; Check that moving from the widget's start works.
+ (widget-forward 2)
+ (should (string= "Third" (widget-value (widget-at))))
+ (widget-backward 1)
+ (should (string= "Second" (widget-value (widget-at))))
+ ;; Check that moving from inside the widget works.
+ (goto-char (point-min))
+ (widget-forward 2)
+ (forward-char)
+ (widget-backward 1)
+ (should (string= "Second" (widget-value (widget-at))))))
+
;;; wid-edit-tests.el ends here