From 91c54be4d239ec889444c3d2b96dae4a827e554f Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sun, 22 Nov 2026 08:17:56 +0700 Subject: [PATCH] ui-widgets: a TileGrid rule head stays a section the grid draws and only stops taking the lead Under GroupHeads::Rule the outline reported the head as no section stop, so the collection built it as an item and handed the group's key to the app's tile painter (the rule-heads story indexed its tiles past their end). The head stays a section stop, cannot take the lead (enabled is false), and declares its section part so its heading node keeps the group's name. --- crates/ui-widgets/src/tile_grid/grid.rs | 3 ++- crates/ui-widgets/src/tile_grid/headers.rs | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/crates/ui-widgets/src/tile_grid/grid.rs b/crates/ui-widgets/src/tile_grid/grid.rs index 4b3d54437..1cf15fa15 100644 --- a/crates/ui-widgets/src/tile_grid/grid.rs +++ b/crates/ui-widgets/src/tile_grid/grid.rs @@ -570,8 +570,9 @@ impl Component for TileGrid<'_, K> continue; } if rule { - // A divider takes no press and no stop: it is placed for its paint only. + // A divider takes no press and no stop: its part only carries the heading node. self.placed.push(Placed { group, rect, pinned: false, toggle: false }); + cx.part(section_part(&declared.key), rect); continue; } let column = self diff --git a/crates/ui-widgets/src/tile_grid/headers.rs b/crates/ui-widgets/src/tile_grid/headers.rs index 8b7b770df..c4da27bc5 100644 --- a/crates/ui-widgets/src/tile_grid/headers.rs +++ b/crates/ui-widgets/src/tile_grid/headers.rs @@ -24,7 +24,7 @@ pub(super) struct Outline<'s, K> { /// The keys of the tail rows. tail: Vec, collapsible: bool, - /// Under `Rule` a header is a divider: it is a row of the outline but no stop. + /// Under `Rule` a header is a divider: it is a row of the outline the grid draws, but it never takes the lead. heads: GroupHeads, } @@ -97,11 +97,7 @@ impl DisplayOrder for Outline<'_, K> { } fn section_stop(&self, at: usize) -> bool { - match self.slot(at) { - Slot::Header(_) => self.heads == GroupHeads::Titled, - Slot::Tail(_) => true, - Slot::Tile(_) => false, - } + self.is_section(at) } fn section_stops_before(&self, at: usize) -> usize { @@ -110,7 +106,8 @@ impl DisplayOrder for Outline<'_, K> { fn enabled(&self, at: usize) -> bool { match self.slot(at) { - Slot::Header(_) | Slot::Tail(_) => true, + Slot::Header(_) => self.heads == GroupHeads::Titled, + Slot::Tail(_) => true, Slot::Tile(tile) => self.inner.enabled(tile), } }