From e1120bb64442fab667a35068604513b48b0ee6fd Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Sun, 1 May 2022 21:19:11 -0500 Subject: [PATCH] ensure all nodes have a intialized layout --- packages/tui/src/layout.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/tui/src/layout.rs b/packages/tui/src/layout.rs index 8258b32ea..f56f48955 100644 --- a/packages/tui/src/layout.rs +++ b/packages/tui/src/layout.rs @@ -36,9 +36,11 @@ pub(crate) struct StretchLayout { impl ChildDepState for StretchLayout { type Ctx = Rc>; type DepState = Self; - // todo: update mask + // use tag to force this to be called when a node is built const NODE_MASK: NodeMask = - NodeMask::new_with_attrs(AttributeMask::Static(SORTED_LAYOUT_ATTRS)).with_text(); + NodeMask::new_with_attrs(AttributeMask::Static(SORTED_LAYOUT_ATTRS)) + .with_text() + .with_tag(); /// Setup the layout fn reduce<'a>( @@ -73,6 +75,7 @@ impl ChildDepState for StretchLayout { } else { self.node = PossiblyUninitalized::Initialized(stretch.new_node(style, &[]).unwrap()); + changed = true; } } else { // gather up all the styles from the attribute list @@ -104,6 +107,7 @@ impl ChildDepState for StretchLayout { self.node = PossiblyUninitalized::Initialized( stretch.new_node(style, &child_layout).unwrap(), ); + changed = true; } } if self.style != style {