Function: eca-chat--sync-context-line
eca-chat--sync-context-line is a natively compiled function defined in
eca-chat.el.
Signature
(eca-chat--sync-context-line CONTEXT-OV)
Documentation
Drop the contexts whose item on the context line is no longer whole.
CONTEXT-OV is the context area overlay. A region deletion (evil
d0, C-u in insert state, a visual selection...) can take part
of an item with it; the context then counts as removed, like a
backspace on the item does, and the line is redrawn from
eca-chat--context.
Source Code
;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--sync-context-line (context-ov)
"Drop the contexts whose item on the context line is no longer whole.
CONTEXT-OV is the context area overlay. A region deletion (evil
`d0', `C-u' in insert state, a visual selection...) can take part
of an item with it; the context then counts as removed, like a
backspace on the item does, and the line is redrawn from
`eca-chat--context'."
(let* ((start (overlay-start context-ov))
(end (save-excursion (goto-char start) (line-end-position)))
(pos start)
(whole '()))
(while (< pos end)
(let ((next (next-single-property-change pos 'eca-chat-context-item nil end))
(item (get-text-property pos 'eca-chat-context-item)))
(when (and item
(eql (- next pos) (get-text-property pos 'eca-chat-item-str-length)))
(push item whole))
(setq pos next)))
(let ((kept (--filter (member it whole) eca-chat--context)))
(unless (equal kept eca-chat--context)
(setq-local eca-chat--context kept)
(eca-chat--refresh-context)
(end-of-line)))))