aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/wid-edit.el1
-rw-r--r--test/lisp/wid-edit-tests.el21
2 files changed, 21 insertions, 1 deletions
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index f920130226e..8b10d71dcb3 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -1204,7 +1204,6 @@ This is much faster.")
1204ARG may be negative to move backward. 1204ARG may be negative to move backward.
1205When the second optional argument is non-nil, 1205When the second optional argument is non-nil,
1206nothing is shown in the echo area." 1206nothing is shown in the echo area."
1207 (or (bobp) (> arg 0) (backward-char))
1208 (let ((wrapped 0) 1207 (let ((wrapped 0)
1209 (number arg) 1208 (number arg)
1210 (old (widget-tabable-at))) 1209 (old (widget-tabable-at)))
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."
301 (should child) 301 (should child)
302 (should (equal (widget-value widget) '((1 "One"))))))) 302 (should (equal (widget-value widget) '((1 "One")))))))
303 303
304(ert-deftest widget-test-widget-move ()
305 "Test moving with `widget-forward' and `widget-backward'."
306 (with-temp-buffer
307 (dolist (el '("First" "Second" "Third"))
308 (widget-create 'push-button el))
309 (widget-insert "\n")
310 (use-local-map widget-keymap)
311 (widget-setup)
312 (goto-char (point-min))
313 ;; Check that moving from the widget's start works.
314 (widget-forward 2)
315 (should (string= "Third" (widget-value (widget-at))))
316 (widget-backward 1)
317 (should (string= "Second" (widget-value (widget-at))))
318 ;; Check that moving from inside the widget works.
319 (goto-char (point-min))
320 (widget-forward 2)
321 (forward-char)
322 (widget-backward 1)
323 (should (string= "Second" (widget-value (widget-at))))))
324
304;;; wid-edit-tests.el ends here 325;;; wid-edit-tests.el ends here