Function: magit-section-update-paint

magit-section-update-paint is a byte-compiled function defined in magit-section.el.

Signature

(magit-section-update-paint SECTION FOCUSED-SECTIONS)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-section-20260330.1102/magit-section.el
;;; Paint

(defun magit-section-update-paint (section focused-sections)
  (cl-flet ((paint (highlight)
              (let ((inhibit-read-only t))
                (save-excursion
                  (goto-char (oref section start))
                  (magit-section-paint section highlight))))
            (unregister ()
              (setq magit-section-highlighted-sections
                    (delq section magit-section-highlighted-sections))))
    (if (magit-section-hidden section)
        ;; If the section is highlighted but unfocused, it remains
        ;; highlighted, but `magit-section--opportunistic-paint' via
        ;; `magit-section-show' will unhighlight on expansion, and
        ;; before then (or if a refresh occurs first) it doesn't matter.
        (unregister)
      (pcase (list (if (memq section focused-sections) 'focus 'unfocus)
                   (oref section painted))
        (`(focus ,(or 'nil 'plain))
         (paint t)
         (cl-pushnew section magit-section-highlighted-sections))
        (`(focus highlight)
         (cl-pushnew section magit-section-highlighted-sections))
        (`(unfocus ,(or 'nil 'highlight))
         (paint nil)
         (unregister))
        ('(unfocus plain)
         (unregister))))))