Function: ghostel--tty-esc
ghostel--tty-esc is a natively compiled function defined in
ghostel.el.
Signature
(ghostel--tty-esc MAP)
Documentation
Translate a lone ESC to escape in ghostel terminal-input buffers.
menu-item filter on the ESC entry of a TTY's input-decode-map.
When no follow-up byte arrives within ghostel-tty-escape-delay,
yield the escape event; otherwise return MAP so escape sequences
and ESC-as-meta decode as usual.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--tty-esc (map)
"Translate a lone ESC to `escape' in ghostel terminal-input buffers.
`menu-item' filter on the ESC entry of a TTY's `input-decode-map'.
When no follow-up byte arrives within `ghostel-tty-escape-delay',
yield the `escape' event; otherwise return MAP so escape sequences
and ESC-as-meta decode as usual."
(if (and ghostel-tty-escape-delay
(ghostel--terminal-input-mode-p)
ghostel--term
(let* ((keys (this-single-command-keys))
(len (length keys)))
(and (> len 0)
(eq (aref keys (1- len)) ?\e)
;; The first ESC of a fast pair is already committed
;; when the second decodes; leave the second raw so
;; [27 27] reaches the ESC ESC binding instead of
;; the unbound ESC <escape>.
(not (and (> len 1) (eq (aref keys (- len 2)) ?\e)))))
(sit-for ghostel-tty-escape-delay))
[escape]
map))