Function: eca-chat--refresh-progress

eca-chat--refresh-progress is a natively compiled function defined in eca-chat.el.

Signature

(eca-chat--refresh-progress CHAT-BUFFER)

Documentation

Refresh the progress TEXT for CHAT-BUFFER.

No-op when the progress overlay is missing (inconsistent buffer state, see #283).

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--refresh-progress (chat-buffer)
  "Refresh the progress TEXT for CHAT-BUFFER.
No-op when the progress overlay is missing (inconsistent buffer
state, see #283)."
  (when (buffer-live-p chat-buffer)
    (eca-chat--with-current-buffer chat-buffer
      (save-excursion
        (when-let* ((ov (eca-chat--prompt-progress-field-ov))
                    ;; Pad the spinner to a fixed width so the line width
                    ;; doesn't oscillate on every spinner tick (#268).
                    (spinner (if (string-empty-p eca-chat--spinner-string)
                                 ""
                               (format "%-3s" eca-chat--spinner-string)))
                    (progress (if (string-empty-p eca-chat--progress-text)
                                  ""
                                (concat "\n" eca-chat--progress-text))))
          ;; Skip the delete/re-insert when nothing changed, avoiding
          ;; redisplay churn while streaming.
          (unless (string= (concat progress spinner)
                           (buffer-substring-no-properties
                            (overlay-start ov) (overlay-end ov)))
            (goto-char (overlay-start ov))
            (delete-region (point) (overlay-end ov))
            (eca-chat--insert (propertize progress
                                          'font-lock-face 'eca-chat-system-messages-face)
                              spinner)))))))