dj95 / zjstatus

A configurable statusbar plugin for zellij
MIT License
358 stars 6 forks source link

Tab bar "scrolling" #67

Closed wiraki closed 1 week ago

wiraki commented 2 weeks ago

Is your feature request related to a problem? Please describe. The problem arises when there are too many tabs to fit in the horizontal space. At the moment, if I keep opening tabs at some point the status line "overflows" or scrolls to the left and shows only the part that has overflowed.

Describe the solution you'd like I know one solution is to set the precedence of some parts to hide when they overlap, but this would be another solution to this problem:

It would be nice if instead of having to hide parts, there would be a "virtual" tab created on the left or the right signifying how many more tabs there are that cannot be shown at the moment. In fact, this is how vanilla Zellij handles it, there is a small tab with "+x tabs" created when there are too many to show.

Additional context Please excuse me if that is already possible, I tried to find documentation to do that but couldn't find it.

EvanEdwards commented 2 weeks ago

Just to add an option, shrinking the tabs when the total exceeds the columns (trimming the rightmost characters from {name}) is another option which would be nice. I have a prompt that sets the tab name to a shortened path which runs me up against this issue fairly often.

image

Another option would be to have a short format for the tabs when you run out of space. In my case, I'd probably just include the {index}.

dj95 commented 1 week ago

Hi and thanks for your feature request and ideas. Unfortunately it will be not that easy, since everything is rendered in order, such that we cannot really say, how much space a widget can/should occupy. Therefore it's not really easy to implement a logic based on the size. It would also mean, that other widgets should also gain this functionality, which will impose the problem of priorities.

As this gets complex quite quickly, we could implement the scrolling behavior based on the tab count. Basically everything above a configurable amount of tabs will be hidden. This simplifies the logic and will introduce the missing feature. However, this would not adapt to different screen sizes.

dj95 commented 1 week ago

I've implemented it now with the option to limit the tab count, as it's not really possible to limit it by size due to the flexibility and dynamic rendering of zjstatus. It will be released with the next version. Here's a sneak peak. It's also possible to navigate between the tabs with the indicators.

https://github.com/dj95/zjstatus/assets/4348959/b7698dbf-e4ac-4728-92e7-4088889022cd

Hopefully it suffices your feature request.

dj95 commented 1 week ago

Forgot to mention, that you can of course specify the count in the indicator :)

https://github.com/dj95/zjstatus/assets/4348959/7cbf3407-eaa1-4ce6-99e7-b63921d28e91

wiraki commented 5 days ago

Thank you!