changeset 39240:e2d428b5bfea

(comint-send-input): When waiting for echoed input, don't save the expected end position in `echo-end', so that things work properly even if the buffer is modified elsewhere at the same time [this happens if `comint-truncate-buffer' is used].
author Miles Bader <miles@gnu.org>
date Tue, 11 Sep 2001 08:40:08 +0000
parents 246f0728f1d7
children 2743aa3f704e
files lisp/comint.el
diffstat 1 files changed, 25 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/comint.el	Tue Sep 11 08:31:16 2001 +0000
+++ b/lisp/comint.el	Tue Sep 11 08:40:08 2001 +0000
@@ -1469,26 +1469,31 @@
 	  (funcall comint-input-sender proc input)
 
 	  ;; Optionally delete echoed input (after checking it).
- 	  (if comint-process-echoes
-	      (let* ((echo-len (- comint-last-input-end
-				  comint-last-input-start))
-		     (echo-end (+ comint-last-input-end echo-len)))
-		;; Wait for all input to be echoed:
-		(while (and (accept-process-output proc)
-			    (> echo-end (point-max))
-			    (= 0 (compare-buffer-substrings
-				  nil comint-last-input-start
-				  (- (point-max) echo-len)
-				  ;; Above difference is equivalent to
-				  ;; (+ comint-last-input-start
-				  ;;    (- (point-max) comint-last-input-end))
-				  nil comint-last-input-end (point-max)))))
- 		(if (and
- 		     (<= echo-end (point-max))
- 		     (= 0 (compare-buffer-substrings
- 			   nil comint-last-input-start comint-last-input-end
- 			   nil comint-last-input-end echo-end)))
- 		    (delete-region comint-last-input-end echo-end))))
+ 	  (when comint-process-echoes
+	    (let ((echo-len (- comint-last-input-end
+			       comint-last-input-start)))
+	      ;; Wait for all input to be echoed:
+	      (while (and (accept-process-output proc)
+			  (> (+ comint-last-input-end echo-len)
+			     (point-max))
+			  (zerop
+			   (compare-buffer-substrings
+			    nil comint-last-input-start
+			    (- (point-max) echo-len)
+			    ;; Above difference is equivalent to
+			    ;; (+ comint-last-input-start
+			    ;;    (- (point-max) comint-last-input-end))
+			    nil comint-last-input-end (point-max)))))
+	      (if (and
+		   (<= (+ comint-last-input-end echo-len)
+		       (point-max))
+		   (zerop
+		    (compare-buffer-substrings
+		     nil comint-last-input-start comint-last-input-end
+		     nil comint-last-input-end
+		     (+ comint-last-input-end echo-len))))
+		  (delete-region comint-last-input-end
+				 (+ comint-last-input-end echo-len)))))
 
 	  ;; This used to call comint-output-filter-functions,
 	  ;; but that scrolled the buffer in undesirable ways.