Function: eca-chat--ensure-prompt-visible

eca-chat--ensure-prompt-visible is a natively compiled function defined in eca-chat.el.

Signature

(eca-chat--ensure-prompt-visible &optional FORCE)

Documentation

Scroll the chat window so the prompt area stays visible.

Only acts when the user is currently viewing the bottom of the buffer, see eca-chat--viewing-bottom-p. When FORCE is non-nil, scroll unconditionally and keep point at the prompt past eca-chat--with-point-preserved: used right after sending a prompt, when a long user message may already have pushed the prompt below the window end, making the guard always fail, and to resume following the chat after acting on a tool call approval.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--ensure-prompt-visible (&optional force)
  "Scroll the chat window so the prompt area stays visible.
Only acts when the user is currently viewing the bottom of the
buffer, see `eca-chat--viewing-bottom-p'.  When FORCE is non-nil,
scroll unconditionally and keep point at the prompt past
`eca-chat--with-point-preserved': used right after sending a
prompt, when a long user message may already have pushed the
prompt below the window end, making the guard always fail, and to
resume following the chat after acting on a tool call approval."
  (when-let* ((win (get-buffer-window (current-buffer))))
    (when (and (eca-chat--prompt-area-start-point)
               (or force (eca-chat--viewing-bottom-p win)))
      (with-selected-window win
        (goto-char (point-max))
        (recenter -1))
      (when force
        (setq eca-chat--keep-point t)))))