Use newline-based alignment technique on dashboard

Fixes #645, because Emacs' mouse events don't appear to compensate for
variable-width whitespace.
This commit is contained in:
Henrik Lissner 2018-06-02 10:48:55 +02:00
parent 08a453bd5e
commit e66abfb9e8
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -161,22 +161,15 @@ whose dimensions may not be fully initialized by the time this is run."
(save-excursion
(with-silent-modifications
(goto-char (point-min))
(cond ((display-graphic-p)
(delete-region (line-beginning-position) (1+ (line-end-position)))
(insert (propertize
(char-to-string ?\uE001)
'display `((space :align-to 0
:height ,(max 0 (- (/ (window-height (get-buffer-window)) 2)
(/ (count-lines (point-min) (point-max)) 2.5))))))
"\n"))
(t
(while (string-empty-p (buffer-substring-no-properties (line-beginning-position) (line-end-position)))
(delete-region (line-beginning-position) (1+ (line-end-position))))
(insert
"\n"
(make-string (max 0 (- (/ (window-height (get-buffer-window)) 2)
(/ (count-lines (point-min) (point-max)) 2)))
?\n))))))))))
(delete-region (line-beginning-position)
(save-excursion (skip-chars-forward "\n")
(point)))
(insert (make-string
(max 0 (- (/ (window-height (get-buffer-window)) 2)
(truncate (/ (count-lines (point-min) (point-max))
2))
2)) ?\n)
"\n")))))))
(defun +doom-dashboard|detect-project (&rest _)
"Check for a `last-project-root' parameter in the perspective, and set the