Function: majutsu-diff--color-words-paint

majutsu-diff--color-words-paint is a natively compiled function defined in majutsu-diff.el.

Signature

(majutsu-diff--color-words-paint SECTION HIGHLIGHT)

Documentation

Apply or remove a focus background overlay for a color-words SECTION.

When HIGHLIGHT is non-nil, create a single overlay with magit-diff-context-highlight covering the hunk body; otherwise remove it. A single low-priority overlay is used so that per-word ANSI font-lock-face foreground colors show through.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-diff.el
(defun majutsu-diff--color-words-paint (section highlight)
  "Apply or remove a focus background overlay for a color-words SECTION.
When HIGHLIGHT is non-nil, create a single overlay with
`magit-diff-context-highlight' covering the hunk body; otherwise
remove it.  A single low-priority overlay is used so that per-word
ANSI `font-lock-face' foreground colors show through."
  (let ((start (oref section start))
        (end   (oref section end)))
    (dolist (ov (overlays-in start end))
      (when (overlay-get ov 'majutsu-color-words-highlight)
        (delete-overlay ov)))
    (when highlight
      (save-excursion
        (goto-char start)
        (forward-line)                  ; skip hunk heading
        (let ((ov (make-overlay (point) end nil t)))
          (overlay-put ov 'majutsu-color-words-highlight t)
          (overlay-put ov 'face 'majutsu-diff-color-words-focus)
          (overlay-put ov 'evaporate t)
          (overlay-put ov 'priority -1))))))