Display: replace boolean with integer count

This will probably be useful when i refactor for the reverse mode
This commit is contained in:
andy.boot
2019-10-02 19:54:00 +01:00
parent fd35734a94
commit 1c60d1e2ac
+2 -3
View File
@@ -69,8 +69,8 @@ fn display_node(
ntp_with_slash.matches('/').count() + 1 ntp_with_slash.matches('/').count() + 1
}; };
let mut num_siblings = count_siblings(to_display, num_slashes - 1, node_to_print); let mut num_siblings = count_siblings(to_display, num_slashes - 1, node_to_print);
let max_siblings = num_siblings;
let mut is_biggest = true;
for &(ref k, _) in to_display.iter() { for &(ref k, _) in to_display.iter() {
let temp = String::from(ensure_end_slash(node_to_print)); let temp = String::from(ensure_end_slash(node_to_print));
if k.starts_with(temp.as_str()) && k.matches('/').count() == num_slashes { if k.starts_with(temp.as_str()) && k.matches('/').count() == num_slashes {
@@ -80,12 +80,11 @@ fn display_node(
k, k,
found, found,
to_display, to_display,
is_biggest, num_siblings == max_siblings - 1,
short_paths, short_paths,
new_depth, new_depth,
&*(new_indent.to_string() + get_tree_chars(num_siblings != 0, has_children)), &*(new_indent.to_string() + get_tree_chars(num_siblings != 0, has_children)),
); );
is_biggest = false;
} }
} }
} }