Function: eshell-handle-control-codes
eshell-handle-control-codes is a byte-compiled function defined in
esh-mode.el.gz.
Signature
(eshell-handle-control-codes)
Documentation
Act properly when certain control codes are seen.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/esh-mode.el.gz
(defun eshell-handle-control-codes ()
"Act properly when certain control codes are seen."
(save-excursion
(goto-char eshell-last-output-block-begin)
(unless (eolp)
(beginning-of-line))
(while (re-search-forward (rx (any ?\r ?\a ?\C-h))
eshell-last-output-end t)
(let ((char (char-before)))
(cond
((eq char ?\r)
(if (< (point) eshell-last-output-end)
(if (memq (char-after (point)) '(?\n ?\r))
(delete-char -1)
(let ((end (point)))
(beginning-of-line)
(delete-region (point) end)))
(add-text-properties (1- (point)) (point)
'(invisible t))))
((eq char ?\a)
(delete-char -1)
(beep))
((eq char ?\C-h)
(delete-region (- (point) 2) (point))))))))