Skip to content

Commit

Permalink
layouts: fix GroupNode::insert_window
Browse files Browse the repository at this point in the history
Fixes #21
  • Loading branch information
Antikyth committed Nov 18, 2023
1 parent e3a52ff commit 7ca86b4
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/layout/implementations/node_changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ impl<Window> GroupNode<Window> {
/// [window node]: WindowNode
#[inline]
pub fn insert_window(&mut self, index: usize, window: Window) {
self.children.insert(index, Node::new_window(window));
self.track_insert(index);
self.insert_node(index, Node::new_window(window));
}

/// Inserts new [window nodes] of the given `windows` at the given `index` in the group.
Expand Down Expand Up @@ -644,14 +643,18 @@ mod tests {

group.push_window_back(1);

assert!(matches!(
&group[0],
Node::Window(WindowNode {
width: 0,
height: 0,
..
})
));
assert!(
matches!(
&group[0],
Node::Window(WindowNode {
width: 0,
height: 0,
..
})
),
"node = {:?}",
&group[0]
);

// Resize the added window.
group.apply_changes(resize_window).unwrap();
Expand Down

0 comments on commit 7ca86b4

Please sign in to comment.