# HG changeset patch # User Gerd Moellmann # Date 999869375 0 # Node ID ed28d0187d3c3251edd4f0bb943b64407072a3b0 # Parent 2903c3858d20ed4e375b308449c9bdcde05e1908 (comint-send-input): Handle comint-process-echoes differently. diff -r 2903c3858d20 -r ed28d0187d3c lisp/comint.el --- a/lisp/comint.el Fri Sep 07 12:42:12 2001 +0000 +++ b/lisp/comint.el Fri Sep 07 13:29:35 2001 +0000 @@ -1422,9 +1422,7 @@ (delete-region pmark start) copy)))) - (if comint-process-echoes - (delete-region pmark (point)) - (insert ?\n)) + (insert ?\n) (comint-add-to-input-history history) @@ -1469,6 +1467,29 @@ ;; clear the "accumulation" marker (set-marker comint-accum-marker nil) (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)))) + ;; This used to call comint-output-filter-functions, ;; but that scrolled the buffer in undesirable ways. (run-hook-with-args 'comint-output-filter-functions ""))))) @@ -1540,7 +1561,7 @@ (delete-char -2))))))))) (add-hook 'comint-output-filter-functions 'comint-carriage-motion) - + ;; The purpose of using this filter for comint processes ;; is to keep comint-last-input-end from moving forward ;; when output is inserted.