1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-25 07:28:20 +00:00

* 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.
This commit is contained in:
Juri Linkov 2022-05-04 22:32:30 +03:00
parent e88d91b1d2
commit 78df8a0e3d

View File

@ -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))