Subject: Re: bug#37667: 27.0.50; Tab Bar display problems with more than 5 tabs

From: Juri Linkov <[email-masked]>
Date: Thu, 17 Oct 2019 01:39:27 +0300

>> But the first question popped up quickly: I don't understand
>> how to detect the situation where the tab-line is truncated?
>
> The situation that it's truncated, or the situation that it _needs_ to
> be truncated, i.e. the next tab doesn't fit on the line?
>
> If the former, the glyph_row->truncated_on_right_p flag should be set.
> You can see it being set in display_string, which is called from
> display_mode_line.
>
> If you mean the latter, then look how the truncated_on_right_p flag is
> being set in display_line or in other similar display functions, like
> display_tab_bar_line.
>
>> And how to find the tab that is visible partially?
>> Especially when the font is variable-pitch.
>
> I think you will need to walk the glyphs in the tab-line looking for
> the last glyph whose character position has the property you put on
> tabs in tab-line (as specified in by tab-line-format).  Or maybe
> tab-line-format should put some special property on the last glyph of
> a tab, so that you could look for it more easily?
>
> Let me know if the above is not detailed enough to get you off the
> ground.

Thanks for the explanation.  One thing that I still don't understand is
how to find the exact position in the mode-line string where it's
truncated.  For example, in the string "...abc|xyz", the part
until "abc" is visible, but the rest of the string is truncated,
so "xyz" is not visible.  How to find this position where truncation occurs?

Actually, it seems I found it, it's it.last_visible_x.  Is this correct?