diff --git a/src/display.rs b/src/display.rs index 89058c8..ddf3fe5 100644 --- a/src/display.rs +++ b/src/display.rs @@ -232,7 +232,8 @@ fn display_node(node: Node, draw_data: &DrawData, is_biggest: bool, is_last: boo percent_bar: bar_text, display_data: draw_data.display_data, }; - let num_siblings = node.children.len() as u64; + + let num_siblings = node.num_siblings(); for (count, c) in get_children_from_node(node, draw_data.display_data.is_reversed).enumerate() { let is_biggest = dd.display_data.is_biggest(count, num_siblings); @@ -398,7 +399,7 @@ mod tests { by_filecount: false, num_chars_needed_on_left_most: 5, base_size: 1, - longest_string_length, + longest_string_length: longest_string_length, ls_colors: LsColors::from_env().unwrap_or_default(), } } diff --git a/src/utils/mod.rs b/src/utils/mod.rs index d7d173c..0552b20 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -46,6 +46,12 @@ impl PartialEq for Node { } } +impl Node { + pub fn num_siblings(&self) -> u64 { + self.children.len() as u64 + } +} + pub fn is_a_parent_of>(parent: P, child: P) -> bool { let parent = parent.as_ref(); let child = child.as_ref();