Commit f900ec31 authored by Miles Bader's avatar Miles Bader
Browse files

(comint-next-prompt): Don't loop infinitely if

{next,previous}-single-char-property-change returns its input position
when the search fails.
parent f621045e
......@@ -2140,14 +2140,21 @@ occurance of text matching `comint-prompt-regexp'."
;; Use input fields
(let ((pos (point))
(input-pos nil))
(input-pos nil)
(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)))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment