Function: eca-chat--ensure-tool-call-approval-visible
eca-chat--ensure-tool-call-approval-visible is a natively compiled
function defined in eca-chat.el.
Signature
(eca-chat--ensure-tool-call-approval-visible ID)
Documentation
Scroll so the label and approval buttons of tool call ID are visible.
Keeps the prompt at the window bottom when the expanded block fits
above it. A block taller than the window would instead push its
label and Accept/Reject buttons above the window (#308), so anchor
the window at the label and move point onto the Accept button:
with the prompt off-screen, leaving point there would make
redisplay scroll right back to it. Once the tool call resolves,
eca-chat--move-on-from-approval brings point back.
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-tool-call-approval-visible (id)
"Scroll so the label and approval buttons of tool call ID are visible.
Keeps the prompt at the window bottom when the expanded block fits
above it. A block taller than the window would instead push its
label and Accept/Reject buttons above the window (#308), so anchor
the window at the label and move point onto the Accept button:
with the prompt off-screen, leaving point there would make
redisplay scroll right back to it. Once the tool call resolves,
`eca-chat--move-on-from-approval' brings point back."
(when-let* ((win (get-buffer-window (current-buffer)))
(ov-label (eca-chat--get-expandable-content id))
(label-start (save-excursion
(goto-char (overlay-start ov-label))
(line-beginning-position))))
(with-selected-window win
(goto-char (point-max))
(recenter -1)
(when (< label-start (window-start win))
(set-window-start win label-start)
(goto-char (or (eca-chat--tool-call-accept-button-pos id) label-start))
(setq eca-chat--keep-point t)))))