ui/doom-dashboard: fix restriction to dashboard buffer

This commit is contained in:
Henrik Lissner 2017-12-28 20:04:46 -05:00
parent f8cfe5878d
commit d8105427e2
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -148,28 +148,27 @@ whose dimensions may not be fully initialized by the time this is run."
(with-current-buffer fallback-buffer (with-current-buffer fallback-buffer
(setq default-directory (setq default-directory
(or (+doom-dashboard--get-pwd) (or (+doom-dashboard--get-pwd)
default-directory))) default-directory))
(unless +doom-dashboard-inhibit-refresh (unless +doom-dashboard-inhibit-refresh
(with-silent-modifications (with-silent-modifications
(unless (eq major-mode '+doom-dashboard-mode) (unless (eq major-mode '+doom-dashboard-mode)
(+doom-dashboard-mode)) (+doom-dashboard-mode))
(erase-buffer) (erase-buffer)
(let ((+doom-dashboard--height (window-height (get-buffer-window fallback-buffer)))
(let ((+doom-dashboard--height (window-height (get-buffer-window fallback-buffer))) (lines 1)
(lines 1) content)
content) (with-temp-buffer
(with-temp-buffer (dolist (widget-name +doom-dashboard-widgets)
(dolist (widget-name +doom-dashboard-widgets) (funcall (intern (format "doom-dashboard-widget--%s" widget-name)))
(funcall (intern (format "doom-dashboard-widget--%s" widget-name))) (insert "\n"))
(insert "\n")) (setq content (buffer-string)
(setq content (buffer-string) lines (count-lines (point-min) (point-max))))
lines (count-lines (point-min) (point-max)))) (insert (make-string (max 0 (- (/ +doom-dashboard--height 2)
(insert (make-string (max 0 (- (/ +doom-dashboard--height 2) (/ lines 2)))
(/ lines 2))) ?\n)
?\n) content))
content)) (unless (button-at (point))
(unless (button-at (point)) (goto-char (next-button (point-min))))))))
(goto-char (next-button (point-min)))))))
;; Update all dashboard windows ;; Update all dashboard windows
(dolist (win (get-buffer-window-list (doom-fallback-buffer) nil t)) (dolist (win (get-buffer-window-list (doom-fallback-buffer) nil t))
(set-window-fringes win 0 0) (set-window-fringes win 0 0)