You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(rune-kit): TabStrip::breaks, elements between a strip's tabs that a drag stops at - #2291
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
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.
macOS, head df440fc4e (dev67ba7ba3f 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TabStrip::breaks: elements that are not tabs between a strip's tabs. A group's header down a sidebar, a divider across a titlebar.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 .- t2Why: 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.keynames 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.a_break_stands_before_its_tab_with_the_strips_gap_on_each_sidea_drag_stops_at_a_breakarrow_keys_cross_a_break