Repository navigation
Why is max_tab_length reduced by 1 for vertical tab bars? #10804
Answered
by
kovidgoyal
timpavone1990
asked this question in
Q&A
Replies: 1 comment
|
Yes, it's intentional. max_tab_length is the width available for the tab's *content*. It does not include the cell the tab bar uses for the separator or decoration at the end of a tab. The horizontal tab bar works the same way: there each tab gets `columns // num_tabs - 1`. For vertical bars, the built-in styles use that last column. For example, the powerline style draws its separator symbol in the rightmost column of every row the title occupies. The slant style adds one back to max_tab_length for the same reason. Keeping the meaning the same for both orientations means a draw_tab function written for one works with the other.
You also don't need to pad titles with spaces for vertical tab bars. Before calling draw_tab, kitty fills the tab's full width, on every line it occupies, with the tab's background color. So a short title doesn't leave a gap showing the tab bar background.
If you still want to fill the full width yourself, use `screen.columns` directly in your script instead of max_tab_length. Note that if you write into the last column and then draw anything more, the cursor wraps to the next line. kitty then counts the tab as one line taller.
|
0 replies
Answer selected by
timpavone1990
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I’m using a custom tab bar script and recently switched to a vertical layout. I have a quick question regarding how
max_tab_lengthis passed to the script.Since I haven't set
tab_title_max_length, kitty defaults the vertical tab bar width to 28 columns (as seen here in state.c).However, the
max_tab_lengthpassed to the script is that value minus 1 (found here in tab_bar.py).What is the reason for this subtraction? It isn't immediately obvious to me.
Context / Why I'm asking:
My custom script pads tab titles with spaces up to
max_tab_length. Because of the-1, the title ends up one space short of filling the full width.I could easily work around this in my script, but I wanted to check first if this behavior is intentional or serves a specific purpose.
All reactions