Mercurial > emacs
changeset 39182:ed28d0187d3c
(comint-send-input): Handle comint-process-echoes
differently.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 07 Sep 2001 13:29:35 +0000 |
parents | 2903c3858d20 |
children | 4ba1f03d41cc |
files | lisp/comint.el |
diffstat | 1 files changed, 25 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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.