Skip to content

fix(tabbar): draw the tab index on split tabs - #556

Merged
tw93 merged 2 commits into
tw93:mainfrom
TeamMeng:fix/split-tab-index
Sep 21, 2026
Merged

tw93 merged 2 commits into
tw93:mainfrom
TeamMeng:fix/split-tab-index

Conversation

@TeamMeng

@TeamMeng TeamMeng commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

What

A tab with a split (two or more panes) renders its pane list without the tab index, even when show_tab_index_in_tab_bar = true, so the tab bar looks like the numbering skips around split tabs. Single-pane tabs and the Rust fallback (build_default_title) both draw the index.

Why

format-tab-title in the bundled kaku.lua returns from the multi-pane branch before the index prefix is applied:

  • assets/macos/Kaku.app/Contents/Resources/kaku.lua:3221 (if #own_panes > 1 and tab.tab_title == '' then) returns its items early
  • the single-pane path only applies tab_index .. ':' at assets/macos/Kaku.app/Contents/Resources/kaku.lua:3395

Rendered title for a three-pane tab in apps/psygo with tab index 2, measured through the same Lua harness the config tests use:

tab budget before after
12 " apps/psygo " " 2:psygo "
16 " apps/psygo " " 2:apps/psygo "
32 " apps/psygo " " 2:apps/psygo "

How

The index is charged against the same title budget the single-pane path truncates to (total_limit - leading - 1, minus the index width), and it is dropped rather than clipped when the tab is too narrow to afford it. The trailing status cell still survives every width budget, which is what the existing narrow-width gate checks.

Tests

bundled_kaku_lua_tab_titles_fit_narrow_width_budgets now enables show_tab_index_in_tab_bar in its fixture and asserts a multi-pane title keeps the index whenever the budget can afford it. It fails on main:

multi-pane title should keep the tab index in a 4-column budget: " r… "
  • cargo test -p config
  • luajit -e "assert(loadfile('assets/macos/Kaku.app/Contents/Resources/kaku.lua'))" for the top-level 200-locals limit

Issue

Refs #397 - that request landed for single-pane tabs in #434; the multi-pane
branch kept returning before the index prefix was applied.

The multi-pane branch of the bundled format-tab-title handler returned
before the show_tab_index_in_tab_bar prefix was applied, so a tab with
two or more panes lost the index that single-pane tabs and the Rust
fallback both draw.

Charge the index against the title budget the single-pane path
truncates to, and drop it when the tab is too narrow to afford it, so a
narrow split tab still cannot clip into the trailing status cell.
@vercel

vercel Bot commented Sep 20, 2026

Copy link
Copy Markdown

@TeamMeng is attempting to deploy a commit to the Faberon Team on Vercel.

A member of the Team first needs to authorize it.

@TeamMeng TeamMeng closed this Sep 20, 2026
@TeamMeng TeamMeng reopened this Sep 20, 2026
The regression test only exercised a single-digit index with
show_tab_index_in_tab_bar hard-coded on, so the shipped default (off) and a
two-digit index were never checked:

- loop four fixture shapes (one pane, four panes, two-digit index, index off)
  instead of pane_count alone
- assert the index is dropped rather than clipped once the budget is exactly
  leading cell + index + trailing status cell
- add a merged-pane fixture (every pane in apps/psygo) asserting
  " 2:apps/psygo " at 14 columns, the shape a split tab takes when it looks
  like it lost its number
- widen the sweep to 16 columns

Verified: fails on the unfixed bundled kaku.lua (" r… " in a 4-column multi-pane
budget), passes with the fix; cargo test -p config 79 passed, clippy and
nightly rustfmt clean.
@tw93
tw93 merged commit 53700c8 into tw93:main Sep 21, 2026
0 of 8 checks passed
@tw93

tw93 commented Sep 21, 2026

Copy link
Copy Markdown
Owner

@TeamMeng thank you for the PR.

This is on main. Split tabs now keep the tab index when show_tab_index_in_tab_bar is on. It will ship in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants