bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Juri Linkov
Subject: bug#37667: 27.0.50; Tab Bar display problems with more than 5 tabs
Date: Sat, 02 Nov 2019 21:06:05 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>> C code is only need to calculate the number of tabs to cut on the left
>> side from the current tab to make it visible.
>
> AFAIU, there are several alternatives of how to go about the arrow
> buttons that hscroll the tab-line:
>
>  . Always display both of them, but make one or both of them do
>    nothing when scrolling in that direction makes no sense.

Or maybe to disable (visually using a grey shadow) the button
that can't do scrolling?

>  . Display one arrow on the left and another on the right, and decide
>    whether or not to display the right one in display_mode_line,
>    depending on whether you hit (last_visible_x - arrow_width) while
>    producing glyphs.

Do you mean displaying the arrow on the right using fringe?
Currently in buffers clicking on the fridge truncation indicator
arrow image signals

  <right-fringe> <mouse-1> is undefined

And on tty, fridges are not available at all.

>  . Add a new function, exposed to Lisp, to provide indication for
>    whether the right arrow will be needed, then use a proper
>    tab-line-format to actually display the arrow.
>
> It sounds like you decided to use the last alternative, but did you
> consider the other two?

Yes, I'd like to implement the last alternative.

> The first one sounds the easiest to me.

The first one is easy to implement, but it can't do auto-scrolling,
i.e. when the current tab becomes invisible, automattically reduce
the number of tabs in front of it to make it visible.

> the last one has a disadvantage that it does the tab-line processing
> twice, once to determine whether the right arrow is needed, and then
> again to actually display the tab-line.

Twice processing is not a problem: I see that pos_visible_p does
processing twice as well - it calls display_mode_line
before calculating whether a position is visible.

> If you want to implement the last one, then you need a function
> that calls display_mode_line and returns a truncation indication
> depending on the state of it.glyph_row->truncated_on_right_p.  The
> simplest way to achieve that is to add a new argument to
> display_mode_line, which, when non-NULL, will be a pointer to the flag
> where to return to the caller the truncation indication; then make
> display_mode_line set that flag according to the truncated_on_right_p
> flag.

Modifying display_mode_line is one way.  I thought maybe simpler
would be to copy some relevant code from display_mode_line
to a new function.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]