From e66abfb9e8db68bc309254ca9786eac599dee072 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 2 Jun 2018 10:48:55 +0200 Subject: [PATCH] Use newline-based alignment technique on dashboard Fixes #645, because Emacs' mouse events don't appear to compensate for variable-width whitespace. --- modules/ui/doom-dashboard/config.el | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/modules/ui/doom-dashboard/config.el b/modules/ui/doom-dashboard/config.el index a446f2d8a..3bb095155 100644 --- a/modules/ui/doom-dashboard/config.el +++ b/modules/ui/doom-dashboard/config.el @@ -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