Function: magit-section-maybe-update-visibility-indicator

magit-section-maybe-update-visibility-indicator is a byte-compiled function defined in magit-section.el.

Signature

(magit-section-maybe-update-visibility-indicator SECTION)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-section-20260330.1102/magit-section.el
(defun magit-section-maybe-update-visibility-indicator (section)
  (when-let* ((indicator (magit-section-visibility-indicator))
              (_(magit-section-content-p section)))
    (let* ((beg (oref section start))
           (eoh (magit--eol-position beg))
           (kind (cl-typecase (car indicator)
                   (symbol    'fringe)
                   (character 'margin)
                   (string    'ellipsis)))
           (indicator (if (or (oref section hidden)
                              (eq kind 'ellipsis))
                          (car indicator)
                        (cdr indicator))))
      (pcase kind
        ((or 'fringe 'margin)
         (let ((ov (magit--overlay-at beg 'magit-vis-indicator kind)))
           (unless ov
             (setq ov (make-overlay beg eoh nil t))
             (overlay-put ov 'evaporate t)
             (overlay-put ov 'magit-vis-indicator kind))
           (overlay-put
            ov 'before-string
            (pcase kind
              ('fringe
               (propertize "fringe" 'display
                           `(left-fringe ,indicator fringe)))
              ('margin
               (propertize "margin" 'display
                           `((margin left-margin)
                             ,(propertize (string indicator)
                                          'face 'magit-left-margin))))))))
        ('ellipsis
         (let ((ov (magit--overlay-at (1- eoh) 'magit-vis-indicator 'eoh)))
           (cond ((oref section hidden)
                  (unless ov
                    (setq ov (make-overlay (1- eoh) eoh))
                    (overlay-put ov 'evaporate t)
                    (overlay-put ov 'magit-vis-indicator 'eoh))
                  (overlay-put ov 'after-string indicator))
                 (ov
                  (delete-overlay ov)))))))))