Subject: bug#56874: 28.1.50; tab-bar-format-align-right should probably use string-width

From: Juri Linkov <[email-masked]>
Date: Mon, 01 Aug 2022 21:13:43 +0300

> I noticed that, when I added a mode line construct to global-mode-line and
> enabled the display of such in the tab line (using
> tab-bar-format-align-right, etc.), the construct wrapped onto a second line
> in the tab bar.  I looked at the source code of tab-bar-format-align-right
> and noticed that it uses length instead of string-width.  I changed it to
> string-width and it fixed the problem.
>
> Note that a similar problem remains: if the tab-bar face has, for example,
> a larger height than the default face, the width will still be incorrectly
> calculated, causing wrapping onto a new line.  I don't know how to fix
> that, since window-text-pixel-size requires a buffer and a window.
>
> But this is an improvement, anyway.

Please check Emacs 29 where tab-bar-format-align-right
contains a better improvement:

  (string-pixel-width (propertize rest 'face 'tab-bar))

Does this work in your case as well?