This commit is contained in:
larstvei 2024-09-14 23:27:43 +02:00
parent c2524b420e
commit bfc3e1c792

View File

@ -43,17 +43,16 @@
(left-margin (center-content--calculate-left-margin (car content-size)))
(top-margin (center-content--calculate-top-margin (cdr content-size))))
;; Apply horizontal centering using overlay
(let ((overlay (make-overlay (point-min) (point-max))))
(overlay-put overlay 'line-prefix
(propertize " " 'display `(space :width ,left-margin)))
(let ((overlay (make-overlay (point-min) (point-max)))
(space (propertize " " 'display `(space :width ,left-margin))))
(overlay-put overlay 'line-prefix space)
(setq center-content--horizontal-overlay overlay))
;; Apply vertical centering using header-line-format
;; Save and remap the header-line face to match the default face
(setq center-content--original-header-line-format header-line-format)
(setq center-content--header-line-face-remap-cookie
(face-remap-add-relative 'header-line 'default))
(setq header-line-format
(propertize " " 'display `(height ,top-margin)))
(setq header-line-format (propertize " " 'display `(height ,top-margin)))
;; Save and hide the mode line
(setq center-content--original-mode-line-format mode-line-format)
(setq mode-line-format nil)