diff options
-rw-r--r-- | modeline.el | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/modeline.el b/modeline.el index 09ef407..3af386b 100644 --- a/modeline.el +++ b/modeline.el @@ -24,7 +24,7 @@ ;;; Code: -(defvar modeline-right-offset 6 +(defvar modeline-right-offset 15 "An offset to adjust the modeline alignment.") ;;;###autoload @@ -34,15 +34,17 @@ (right (string-trim-right (modeline-format-right))) (left-len (string-pixel-width left)) (right-len (string-pixel-width right)) + (el-doc-len (string-pixel-width eldoc-mode-line-string)) + (middle-len (max (- (window-pixel-width) + left-len right-len el-doc-len + (- modeline-right-offset)) + 0)) (middle (propertize (string 32) 'display (list 'space - :width - (list - (- (window-pixel-width) left-len right-len - (- modeline-right-offset))))))) + :width (list middle-len))))) (concat left middle right))) (setq-default mode-line-format '("%e" (:eval (modeline-format-main)))) @@ -54,15 +56,18 @@ (right (string-trim-right (modeline-dashboard-format-right))) (left-len (string-pixel-width left)) (right-len (string-pixel-width right)) + (el-doc-len (string-pixel-width eldoc-mode-line-string)) + (middle-len (max (- (window-pixel-width) + left-len right-len el-doc-len + (- modeline-right-offset)) + 0)) (middle (propertize (string 32) 'display (list 'space :width - (list - (- (window-pixel-width) left-len right-len - (- modeline-right-offset))))))) + (list middle-len))))) (concat left middle right))) ;;;###autoload |