Skip to content

feat(rune-kit): TabStrip::breaks, elements between a strip's tabs that a drag stops at - #2291

Merged
Hona merged 5 commits into
devfrom
upstream-g/tab-strip-breaks
Nov 25, 2026
Merged

Hona merged 5 commits into
devfrom
upstream-g/tab-strip-breaks

Conversation

@Hona

@Hona Hona commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

TabStrip::breaks: elements that are not tabs between a strip's tabs. A group's header down a sidebar, a divider across a titlebar.

TabStrip::new("tabs", TabOrientation::Horizontal)
    .tabs(tabs)
    // A 16 × 1 divider before the third tab: the first two tabs and the rest are two groups.
    .breaks([TabBreak::new("api", 2, el().size(1.0, 16.0).fill(c.border_muted), 1.0)])
    .drag_state(&s.drag, |s| &mut s.drag)
    .build(&kit)
flowchart LR
  subgraph lane1["lane 0..2"]
    t0["tab 0"] --- t1["tab 1"]
  end
  b["break before 2"]
  subgraph lane2["lane 2..4"]
    t2["tab 2"] --- t3["tab 3"]
  end
  t1 -. gap .- b -. gap .- t2
Loading
  • Why: an app that groups its tabs (by project, by server) draws a header or a divider between the groups. Today it has to build one strip per group, which share the app's one TabDragState (a gesture names its tab by index in a strip), split the arrow keys at each group, and leave a horizontal strip with no place for a divider.

  • Where a break stands: before the tab at before (the tab count: after the last tab), several before one tab in the order given. key names its wrapper ({strip}-list-break-{key}), so it keeps hover and focus while tabs come and go.

  • Gaps: a horizontal break is one more child of the row, so it has the row's gap on each side. A vertical tab reaches half the gap toward a break as it does toward a tab, and the break pads the other half (Place::reach).

  • Drag: a tab's lane ends at the breaks around it, so a reorder stays inside its group and the tabs past a break never step aside. A torn-out tab's gap closes through the breaks after it (TabDragState::break_shift).

  • Looks: a horizontal tab right after a break draws no separator.

  • Layout math: the breaks' room comes off what horizontal tabs share, and the lazy band and an incoming tab's landing slot count it.

  • No break, no change: a strip without breaks builds as before.

  • One strip for a sectioned sidebar: an app that draws one strip per section under its own headers, all on one TabDragState, can draw one strip with a break per header instead, so the one gesture names one tab. Not changed in any app here.

What an app needs Test (both orientations)
The element before a tab is laid out with its length and the strip's gap on each side a_break_stands_before_its_tab_with_the_strips_gap_on_each_side
A drag does not cross a break a_drag_stops_at_a_break
Arrow keys do cross it arrow_keys_cross_a_break

@Hona

Hona commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Windows x64, head b841f1d47: cargo test -p rune-kit --lib 185 passed, 0 failed, 0 ignored; the nine tab-strip tests among them, the three new ones in both orientations. No warning from rune-kit. A first run had the arrow-key test fail on its own assertion (the arrow selects the tab it reaches, so one more select than it expected); the test now asserts that. Head bae7d15e8 is that plus dev merged in; the whole macOS run on it comes next.

@Hona
Hona marked this pull request as ready for review November 25, 2026 13:40
@Hona
Hona merged commit 4ed81db into dev Nov 25, 2026
4 checks passed
@Hona

Hona commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

macOS, head df440fc4e (dev 67ba7ba3f merged in): the whole run 45624850334 is green: 46 test targets ok, none failed; rune lib 3,560 passed, 0 failed, 16 ignored; rune-kit lib 243 passed, 0 failed, the nine tab-strip tests among them; rune-kit integration 323 passed, 0 failed, 4 ignored. dev took three commits since 67ba7ba3f, none in a file of this change.

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.

1 participant