diff options
author | JSDurand <mmemmew@gmail.com> | 2025-08-20 09:34:06 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2025-08-20 09:34:06 +0800 |
commit | ccedc5fd5efb6377fecbb735e7ccc71b61815194 (patch) | |
tree | 1adc5f8bd19f27c3dcae01ee90348506a0f7ba05 | |
parent | 073085075a19090fe6cb82fd28e166180d4302b2 (diff) |
* modeline.el (modeline-right-offset): Adjust this value a little.
(modeline-format-main, modeline-format-dashboard): Include the
length of eldoc modeline string in the calculations of the middle
space of the modeline, so that we can try to keep the right
information visible in the presence of ELDOC.
-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 |