core: home buffer, more robust centering of stuff

This commit is contained in:
syl20bnr 2015-07-29 22:07:27 -04:00
parent cf682658c9
commit 7f8cf4564d
1 changed files with 8 additions and 5 deletions

View File

@ -107,7 +107,8 @@ If ALL is non-nil then truly all banners can be selected."
(defun spacemacs-buffer//insert-image-banner (banner)
"Display an image banner."
(when (file-exists-p banner)
(let* ((spec (create-image banner))
(let* ((title "[S P A C E M A C S]")
(spec (create-image banner))
(size (image-size spec))
(width (car size))
(left-margin (floor (- spacemacs-buffer--banner-length width) 2)))
@ -116,7 +117,9 @@ If ALL is non-nil then truly all banners can be selected."
(insert (make-string (- left-margin 1) ?\ ))
(insert-image spec)
(insert "\n\n")
(insert " [S P A C E M A C S]\n\n"))))
(insert (make-string (+ left-margin
(floor (/ (- width (length title)) 2))) ?\ ))
(insert (format "%s\n\n" title)))))
(defun spacemacs-buffer//inject-version ()
"Inject the current version of spacemacs in the first line of the
@ -333,7 +336,7 @@ The vertical spacing is always one line."
(delete-char -1))
(let* ((hpadding (or hpadding 1))
(fill-column (if width
(- width hpadding)
(- width (+ 2 (* 2 hpadding)))
fill-column))
(sentence-end-double-space nil)
(caption-len (length caption)))
@ -396,7 +399,7 @@ HPADDING is the horizontal spacing betwee the content line and the frame border.
(defun spacemacs-buffer//insert-buttons ()
(goto-char (point-max))
(insert " ")
(insert " ")
(spacemacs//insert--shortcut "m" "[?]" t)
(widget-create 'url-link
:tag (propertize "?" 'face 'font-lock-doc-face)
@ -444,7 +447,7 @@ HPADDING is the horizontal spacing betwee the content line and the frame border.
:follow-link "\C-m"
(propertize "Rollback" 'face 'font-lock-keyword-face))
(insert "\n")
(insert " ")
(insert " ")
(widget-create 'push-button
:tag (propertize "Release Notes" 'face 'font-lock-preprocessor-face)
:help-echo "Hide or show the Changelog"