From: Juri Linkov Date: Wed, 4 May 2022 19:32:30 +0000 (+0300) Subject: * lisp/tab-bar.el: Use pixel-based alignment (bug#55207) X-Git-Tag: emacs-29.0.90~1931^2~62 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=78df8a0e3d3cce35fbcc972a62200a9da506a0a1;p=emacs.git * 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. --- diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index a0dd20a99ca..42c4b822bc6 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))