diff options
| author | Miles Bader | 2001-08-27 18:13:39 +0000 |
|---|---|---|
| committer | Miles Bader | 2001-08-27 18:13:39 +0000 |
| commit | f900ec31149791243fceae72b550e97e2ff88a98 (patch) | |
| tree | 0c983ea4fa09bc4c75949d2f88c073fee39bdc2d | |
| parent | f621045e3e1422d678934d632af8e18857ee5b29 (diff) | |
| download | emacs-f900ec31149791243fceae72b550e97e2ff88a98.tar.gz emacs-f900ec31149791243fceae72b550e97e2ff88a98.zip | |
(comint-next-prompt): Don't loop infinitely if
{next,previous}-single-char-property-change returns its input position
when the search fails.
| -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'." | |||
| 2140 | (comint-skip-prompt)) | 2140 | (comint-skip-prompt)) |
| 2141 | ;; Use input fields | 2141 | ;; Use input fields |
| 2142 | (let ((pos (point)) | 2142 | (let ((pos (point)) |
| 2143 | (input-pos nil)) | 2143 | (input-pos nil) |
| 2144 | prev-pos) | ||
| 2144 | (while (/= n 0) | 2145 | (while (/= n 0) |
| 2146 | (setq prev-pos pos) | ||
| 2145 | (setq pos | 2147 | (setq pos |
| 2146 | (if (> n 0) | 2148 | (if (> n 0) |
| 2147 | (next-single-char-property-change pos 'field) | 2149 | (next-single-char-property-change pos 'field) |
| 2148 | (previous-single-char-property-change pos 'field))) | 2150 | (previous-single-char-property-change pos 'field))) |
| 2149 | (cond ((null pos) | 2151 | (cond ((or (null pos) (= pos prev-pos)) |
| 2150 | ;; Ran off the end of the buffer. | 2152 | ;; Ran off the end of the buffer. |
| 2153 | (when (> n 0) | ||
| 2154 | ;; There's always an input field at the end of the | ||
| 2155 | ;; buffer, but it has a `field' property of nil. | ||
| 2156 | (setq input-pos (point-max))) | ||
| 2157 | ;; stop iterating | ||
| 2151 | (setq n 0)) | 2158 | (setq n 0)) |
| 2152 | ((eq (get-char-property pos 'field) 'input) | 2159 | ((eq (get-char-property pos 'field) 'input) |
| 2153 | (setq n (if (< n 0) (1+ n) (1- n))) | 2160 | (setq n (if (< n 0) (1+ n) (1- n))) |