1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 12:21:25 -08:00

(widget-move): Don't loop infinitely when there is

no field or button.
This commit is contained in:
Andreas Schwab 2002-12-14 14:27:23 +00:00
parent 2c568af5c7
commit ea13a2b4d4
2 changed files with 12 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2002-12-14 Andreas Schwab <schwab@suse.de>
* wid-edit.el (widget-move): Don't loop infinitely when there is
no field or button.
2002-12-13 Stefan Monnier <monnier@cs.yale.edu>
* uniquify.el (uniquify-rationalize-file-buffer-names, rename-buffer)

View file

@ -1002,19 +1002,20 @@ This is much faster, but doesn't work reliably on Emacs 19.34.")
"Move point to the ARG next field or button.
ARG may be negative to move backward."
(or (bobp) (> arg 0) (backward-char))
(let ((pos (point))
(let ((wrapped 0)
(number arg)
(old (widget-tabable-at))
new)
;; Forward.
(while (> arg 0)
(cond ((eobp)
(goto-char (point-min)))
(goto-char (point-min))
(setq wrapped (1+ wrapped)))
(widget-use-overlay-change
(goto-char (next-overlay-change (point))))
(t
(forward-char 1)))
(and (eq pos (point))
(and (= wrapped 2)
(eq arg number)
(error "No buttons or fields found"))
(let ((new (widget-tabable-at)))
@ -1025,12 +1026,13 @@ ARG may be negative to move backward."
;; Backward.
(while (< arg 0)
(cond ((bobp)
(goto-char (point-max)))
(goto-char (point-max))
(setq wrapped (1+ wrapped)))
(widget-use-overlay-change
(goto-char (previous-overlay-change (point))))
(t
(backward-char 1)))
(and (eq pos (point))
(and (= wrapped 2)
(eq arg number)
(error "No buttons or fields found"))
(let ((new (widget-tabable-at)))