emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 78df8a0e3d: * lisp/tab-bar.el: Use pixel-based alignment (bug#552


From: Juri Linkov
Subject: master 78df8a0e3d: * lisp/tab-bar.el: Use pixel-based alignment (bug#55207)
Date: Wed, 4 May 2022 15:32:51 -0400 (EDT)

branch: master
commit 78df8a0e3d3cce35fbcc972a62200a9da506a0a1
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/tab-bar.el: Use pixel-based alignment (bug#55207)
    
    * lisp/tab-bar.el (tab-bar-format-align-right): Use string-pixel-width
    on the string with tab-bar face to get the width in pixels to align.
    (tab-bar-format-global): Remove string-trim-right to keep padding-right.
---
 lisp/tab-bar.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index a0dd20a99c..42c4b822bc 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -915,8 +915,8 @@ when the tab is current.  Return the result as a keymap."
   (let* ((rest (cdr (memq 'tab-bar-format-align-right tab-bar-format)))
          (rest (tab-bar-format-list rest))
          (rest (mapconcat (lambda (item) (nth 2 item)) rest ""))
-         (hpos (length rest))
-         (str (propertize " " 'display `(space :align-to (- right ,hpos)))))
+         (hpos (string-pixel-width (propertize rest 'face 'tab-bar)))
+         (str (propertize " " 'display `(space :align-to (- right (,hpos))))))
     `((align-right menu-item ,str ignore))))
 
 (defun tab-bar-format-global ()
@@ -926,7 +926,7 @@ When `tab-bar-format-global' is added to `tab-bar-format'
 then modes that display information on the mode line
 using `global-mode-string' will display the same text
 on the tab bar instead."
-  `((global menu-item ,(string-trim-right (format-mode-line 
global-mode-string)) ignore)))
+  `((global menu-item ,(format-mode-line global-mode-string) ignore)))
 
 (defun tab-bar-format-list (format-list)
   (let ((i 0))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]