Function: ghostel--detect-password-prompt
ghostel--detect-password-prompt is a natively compiled function
defined in ghostel.el.
Signature
(ghostel--detect-password-prompt)
Documentation
Update ghostel--password-mode-p and arm the confirm timer.
Called from ghostel--redraw-now once the buffer reflects the
latest output. No-op when ghostel-detect-password-prompts is nil
(e.g. ghostel-compile buffers, which run the pty in canonical+!echo
on purpose). Suppresses re-fires while the cursor is still on the
row where the previous handler returned (see
ghostel--password-handled-cursor).
A rising edge schedules ghostel--confirm-and-prompt after
ghostel-password-prompt-debounce seconds; the falling edge cancels
that timer and, if our read-passwd has already opened, aborts it
via ghostel--cancel-password-prompt. Net effect: short-lived
canonical+!echo flips trigger nothing more than a brief mode-line
indicator flash, mirroring ghostty's transient lock-icon behavior.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--detect-password-prompt ()
"Update `ghostel--password-mode-p' and arm the confirm timer.
Called from `ghostel--redraw-now' once the buffer reflects the
latest output. No-op when `ghostel-detect-password-prompts' is nil
\(e.g. ghostel-compile buffers, which run the pty in `canonical+!echo'
on purpose). Suppresses re-fires while the cursor is still on the
row where the previous handler returned (see
`ghostel--password-handled-cursor').
A rising edge schedules `ghostel--confirm-and-prompt' after
`ghostel-password-prompt-debounce' seconds; the falling edge cancels
that timer and, if our `read-passwd' has already opened, aborts it
via `ghostel--cancel-password-prompt'. Net effect: short-lived
canonical+!echo flips trigger nothing more than a brief mode-line
indicator flash, mirroring ghostty's transient lock-icon behavior."
(when ghostel-detect-password-prompts
(let ((now (ghostel--password-prompt-detected-p))
(cursor ghostel--cursor-pos))
(cond
;; Echo back on — clear all state so a future prompt re-arms.
((not now)
(ghostel--cancel-password-confirm-timer)
(ghostel--cancel-password-prompt)
(when (or ghostel--password-mode-p ghostel--password-handled-cursor)
(setq ghostel--password-mode-p nil
ghostel--password-handled-cursor nil)
(ghostel--mode-line-refresh)))
;; Already showing the indicator (handler is in flight).
(ghostel--password-mode-p nil)
;; Just-handled prompt — wait for the cursor to move off the row.
((and ghostel--password-handled-cursor
cursor
(equal cursor ghostel--password-handled-cursor))
nil)
;; Rising edge: a fresh prompt or a retry on a new row.
(t
(setq ghostel--password-mode-p t
ghostel--password-handled-cursor nil)
(ghostel--mode-line-refresh)
;; Defer so the prompt minibuffer doesn't open from inside the
;; process filter — opening it there blocks further PTY output
;; until the user submits. The debounce additionally gates the
;; open on a re-check after `ghostel-password-prompt-debounce'.
(ghostel--cancel-password-confirm-timer)
(setq ghostel--password-confirm-timer
(run-at-time ghostel-password-prompt-debounce nil
#'ghostel--confirm-and-prompt
(current-buffer))))))))