Function: eca-chat--rebuild-prompt-area

eca-chat--rebuild-prompt-area is a natively compiled function defined in eca-chat.el.

Signature

(eca-chat--rebuild-prompt-area &optional PROMPT-TEXT)

Documentation

Rebuild the prompt block markup with PROMPT-TEXT in the field.

Deletes everything from the first prompt block overlay to the end of the buffer, drops the block overlays and re-inserts a fresh separator, task, progress, context and prompt structure. Recovery path for a corrupted prompt block (see #305).

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--rebuild-prompt-area (&optional prompt-text)
  "Rebuild the prompt block markup with PROMPT-TEXT in the field.
Deletes everything from the first prompt block overlay to the end
of the buffer, drops the block overlays and re-inserts a fresh
separator, task, progress, context and prompt structure.
Recovery path for a corrupted prompt block (see #305)."
  (let* ((inhibit-read-only t)
         (ovs (delq nil (list (eca-chat--prompt-area-ov)
                              (eca-chat--task-area-ov)
                              (eca-chat--prompt-progress-field-ov)
                              (eca-chat--prompt-context-field-ov)
                              (eca-chat--prompt-field-ov))))
         (start (when ovs (apply #'min (mapcar #'overlay-start ovs)))))
    (mapc #'delete-overlay ovs)
    (eca-chat--invalidate-overlay-caches)
    (delete-region (or start (point-max)) (point-max))
    (goto-char (point-max))
    (unless (bolp) (eca-chat--insert "\n"))
    (eca-chat--insert-prompt-string)
    (eca-chat--refresh-context)
    (eca-chat--refresh-transient-area)
    (eca-chat--set-prompt (or prompt-text ""))))