Function: eca-chat--ensure-empty-line-before
eca-chat--ensure-empty-line-before is a natively compiled function
defined in eca-chat.el.
Signature
(eca-chat--ensure-empty-line-before POS)
Documentation
Insert newlines at POS so that an empty line precedes it.
Does nothing at the beginning of the buffer or when the previous line is already empty. Used to separate a user message from the previous answer: blocks leave an empty line after themselves but not before, so the prompt otherwise glues to the end of the last response (#265).
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-empty-line-before (pos)
"Insert newlines at POS so that an empty line precedes it.
Does nothing at the beginning of the buffer or when the previous line
is already empty. Used to separate a user message from the previous
answer: blocks leave an empty line after themselves but not before,
so the prompt otherwise glues to the end of the last response (#265)."
(save-excursion
(goto-char pos)
(unless (bobp)
(cond
((not (bolp)) (eca-chat--insert "\n\n"))
((not (save-excursion (forward-line -1) (eolp)))
(eca-chat--insert "\n"))))))