diff options
author | Miles Bader <miles@gnu.org> | 2001-08-27 18:13:39 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2001-08-27 18:13:39 +0000 |
commit | f900ec31149791243fceae72b550e97e2ff88a98 (patch) | |
tree | 0c983ea4fa09bc4c75949d2f88c073fee39bdc2d /lisp/comint.el | |
parent | f621045e3e1422d678934d632af8e18857ee5b29 (diff) | |
download | emacs-f900ec31149791243fceae72b550e97e2ff88a98.tar.gz |
(comint-next-prompt): Don't loop infinitely if
{next,previous}-single-char-property-change returns its input position
when the search fails.
Diffstat (limited to 'lisp/comint.el')
-rw-r--r-- | lisp/comint.el | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index 3b0ccfc0890..29897a92c58 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -2140,14 +2140,21 @@ occurance of text matching `comint-prompt-regexp'." (comint-skip-prompt)) ;; Use input fields (let ((pos (point)) - (input-pos nil)) + (input-pos nil) + prev-pos) (while (/= n 0) + (setq prev-pos pos) (setq pos (if (> n 0) (next-single-char-property-change pos 'field) (previous-single-char-property-change pos 'field))) - (cond ((null pos) + (cond ((or (null pos) (= pos prev-pos)) ;; Ran off the end of the buffer. + (when (> n 0) + ;; There's always an input field at the end of the + ;; buffer, but it has a `field' property of nil. + (setq input-pos (point-max))) + ;; stop iterating (setq n 0)) ((eq (get-char-property pos 'field) 'input) (setq n (if (< n 0) (1+ n) (1- n))) |