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 (< (point) eshell-last-output-end)
      (let ((char (char-after)))
        (cond
         ((eq char ?\r)
          (if (< (1+ (point)) eshell-last-output-end)
              (if (memq (char-after (1+ (point)))
                        '(?\n ?\r))
                  (delete-char 1)
                (let ((end (1+ (point))))
                  (beginning-of-line)
                  (delete-region (point) end)))
            (add-text-properties (point) (1+ (point))
                                 '(invisible t))
            (forward-char)))
         ((eq char ?\a)
          (delete-char 1)
          (beep))
         ((eq char ?\C-h)
          (delete-region (1- (point)) (1+ (point))))
         (t
          (forward-char)))))))