Function: eca-chat--context-bar-pixels-insert-marker

eca-chat--context-bar-pixels-insert-marker is a natively compiled function defined in eca-chat.el.

Signature

(eca-chat--context-bar-pixels-insert-marker SEGS MARKER-X)

Documentation

Overlay the auto-compaction marker on SEGS near MARKER-X pixels.

SEGS is a list of (PX . COLOR); return a new list with the same total width, the marker overwriting eca-chat--context-bar-marker-px pixels clamped to stay fully visible.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--context-bar-pixels-insert-marker (segs marker-x)
  "Overlay the auto-compaction marker on SEGS near MARKER-X pixels.
SEGS is a list of (PX . COLOR); return a new list with the same total
width, the marker overwriting `eca-chat--context-bar-marker-px' pixels
clamped to stay fully visible."
  (let* ((total (apply #'+ 0 (mapcar #'car segs)))
         (mw (min eca-chat--context-bar-marker-px total))
         (m-start (max 0 (min marker-x (- total mw))))
         (m-end (+ m-start mw))
         (mcolor (or (face-foreground 'eca-chat-context-compaction-marker-face nil t)
                     "#888888"))
         (x 0)
         (out nil))
    (dolist (s segs)
      (let* ((px (car s)) (color (cdr s))
             (start x) (end (+ x px))
             (le (max start (min end m-start)))
             (me (max start (min end m-end))))
        (when (> (- le start) 0) (push (cons (- le start) color) out))
        (when (> (- me le) 0) (push (cons (- me le) mcolor) out))
        (when (> (- end me) 0) (push (cons (- end me) color) out))
        (setq x end)))
    (nreverse out)))