Dynamic vertical alignment of the dashboard #192

This commit is contained in:
Henrik Lissner 2017-09-29 02:41:48 +02:00
parent 27b1d08c19
commit 6259ba9114
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -116,11 +116,19 @@ whose dimensions may not be fully initialized by the time this is run."
(+doom-dashboard-mode))
(erase-buffer)
(setq default-directory old-pwd)
(let ((+doom-dashboard--height (window-height (get-buffer-window fallback-buffer))))
(insert (make-string (max 0 (- (truncate (/ +doom-dashboard--height 2)) 16)) ?\n))
(dolist (widget-name +doom-dashboard-widgets)
(funcall (intern (format "doom-dashboard-widget--%s" widget-name)))
(insert "\n")))
(let ((+doom-dashboard--height (window-height (get-buffer-window fallback-buffer)))
(lines 1)
content)
(with-temp-buffer
(dolist (widget-name +doom-dashboard-widgets)
(funcall (intern (format "doom-dashboard-widget--%s" widget-name)))
(insert "\n"))
(setq content (buffer-string)
lines (count-lines (point-min) (point-max))))
(insert (make-string (max 0 (- (/ +doom-dashboard--height 2)
(/ lines 2)))
?\n)
content))
(unless (button-at (point))
(goto-char (next-button (point-min))))))))
;; Update all dashboard windows