Function: magit-section-update-highlight

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

Signature

(magit-section-update-highlight &optional FORCE)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-section-20260330.1102/magit-section.el
(defun magit-section-update-highlight (&optional force)
  (let ((section (magit-current-section))
        (focused (magit-focused-sections)))
    (cond
      ((or force
           magit-section-highlight-force-update
           (xor magit-section-pre-command-region-p (region-active-p))
           (not (eq magit-section-pre-command-section section)))
       (let ((inhibit-read-only t)
             (deactivate-mark nil)
             (selection (magit-region-sections)))
         (mapc #'delete-overlay magit-section-highlight-overlays)
         (mapc #'delete-overlay magit-section-selection-overlays)
         (setq magit-section-highlight-overlays nil)
         (setq magit-section-selection-overlays nil)
         (cond ((magit-section--maybe-enable-long-lines-shortcuts))
               ((eq section magit-root-section))
               ((not magit-section-highlight-current)
                (when selection
                  (magit-section-highlight-selection selection)))
               ((not selection)
                (magit-section-highlight section))
               (t
                (mapc #'magit-section-highlight selection)
                (magit-section-highlight-selection selection)))
         (dolist (section (cl-union magit-section-highlighted-sections focused))
           (when (slot-boundp section 'painted)
             (magit-section-update-paint section focused)))
         (restore-buffer-modified-p nil)))
      ((and (eq magit-section-pre-command-section section)
            magit-section-selection-overlays
            (region-active-p)
            (not (magit-region-sections)))
       (mapc #'delete-overlay magit-section-selection-overlays)
       (setq magit-section-selection-overlays nil)))
    (setq magit-section-highlight-force-update nil)
    (magit-section-maybe-paint-visibility-ellipses)))