1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-27 07:41:28 -08:00

(comint-send-input): Handle comint-process-echoes

differently.
This commit is contained in:
Gerd Moellmann 2001-09-07 13:30:50 +00:00
parent 70569550f7
commit c9e74cd4be
2 changed files with 31 additions and 5 deletions

View file

@ -1422,9 +1422,7 @@ Similarly for Soar, Scheme, etc."
(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 @@ Similarly for Soar, Scheme, etc."
;; 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 @@ This function should be in the list `comint-output-filter-functions'."
(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.