Function: viper--tty-ESC-filter

viper--tty-ESC-filter is a byte-compiled function defined in viper.el.gz.

Signature

(viper--tty-ESC-filter MAP)

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/viper.el.gz
;;; Handling of tty's ESC event

;; On a tty, an ESC event can either be the user hitting the escape key, or
;; some element of a byte sequence used to encode for example cursor keys.
;; So we try to recognize those events that correspond to the escape key and
;; turn them into `escape' events (same as used under GUIs).  The heuristic we
;; use to distinguish the two cases is based, as usual, on a timeout, and on
;; the fact that the special ESC=>escape mapping only takes place if the whole
;; last key-sequence so far is just [?\e], i.e. either we're still in
;; read-key-sequence, or the last read-key-sequence only read [?\e], which
;; should ideally never happen because it should have been mapped to [escape].

(defun viper--tty-ESC-filter (map)
  (if (and (equal (this-single-command-keys) [?\e])
           (sit-for (/ viper-fast-keyseq-timeout 1000)))
      [escape] map))