Function: eca-chat-inline--viewport
eca-chat-inline--viewport is a natively compiled function defined in
eca-chat-inline.el.
Signature
(eca-chat-inline--viewport OV BODY FINISHED)
Documentation
Return the visible window of BODY for OV.
Shows at most eca-chat-inline-max-lines lines: the tail while
streaming, the head when FINISHED, or the manual offset stored in
the eca-chat-inline--scroll overlay property. Hidden parts are
announced by indicator lines carrying the scroll keys.
Source Code
;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat-inline.el
(defun eca-chat-inline--viewport (ov body finished)
"Return the visible window of BODY for OV.
Shows at most `eca-chat-inline-max-lines' lines: the tail while
streaming, the head when FINISHED, or the manual offset stored in
the `eca-chat-inline--scroll' overlay property. Hidden parts are
announced by indicator lines carrying the scroll keys."
(let* ((lines (split-string body "\n"))
(total (length lines))
(max-lines eca-chat-inline-max-lines))
(if (or (not (integerp max-lines)) (<= total max-lines))
body
(let* ((max-offset (- total max-lines))
(offset (or (overlay-get ov 'eca-chat-inline--scroll)
(if finished 0 max-offset)))
(offset (min (max offset 0) max-offset)))
(concat
(when (> offset 0)
(propertize (format "ā +%d lines (p)\n" offset)
'face 'eca-chat-inline-in-progress-face))
(mapconcat #'identity (-take max-lines (-drop offset lines)) "\n")
(when (< offset max-offset)
(propertize (format "\nā +%d lines (n)" (- max-offset offset))
'face 'eca-chat-inline-in-progress-face)))))))