Subject: bug#78953: 31.0.50; tab-bar-format-align-right alignment breaks if field widths change

From: Daniel Mendler <[email-masked]>
Date: Thu, 10 Jul 2025 22:02:45 +0200

Juri Linkov <[email-masked]> writes:

>> Since we are talking about the tab bar already I have another question -
>> sometimes (rarely) my tab bar gets too long and then it wraps around,
>
> It wraps around because the tab-bar is multi-line:
> the number of tab-bar lines is defined by the frame parameter
> 'tab-bar-lines'.  So you can use more lines for text that
> doesn't fit on the first line.

I would like to fix tab-bar-lines to be 1.

>> which I find undesirable.
>
> Is this when you set tab-bar-auto-width to nil?
> Or the global string is too long?

I set tab-bar-auto-width=nil in my config. Then the wrap around happens
if there are too many elements in the tab-bar-format list.

>> I would prefer if the content were truncated.
>
> Can you truncate the global string inside :eval, e.g.
>
> (setq global-mode-string
>       '("|" (:eval (truncate-string-to-width (make-string 100 ?#) 10)) "|"))

Of course, but this does not help if I have many elements in the
tab-bar-format list which I cannot truncate together with such a simple
expression.

>> I suspect this is harder to address,
>
> The wrapping is hard to disable.  So it's easier to truncate
> the overly long strings.

In my use case truncating the many overly long strings is not easy - I
would have to compute how much I have to take away from each element.
But I understand that disabling the overall wrap around is more
difficult since it has to be implement on a deeper level of the display
engine.

>> e.g., via an option tab-bar-truncate/tab-line-truncate? In any case,
>> this is a rare edge case in my usage.
>
> There are truncation options only for tab names, not for the global string.

Yes, therefore I proposed that such options could be added.

Daniel