listing: fix mailbox tree rendering

Indentation value was being interpreted mirrored (raw binary value in
parenthesis):

   0  testing_account (0)
   1   ┣━Archives     (0)
   2   ┃ ┣━2014       (1)
   3   ┃ ┃ ┗━10       (11)
   4   ┃ ┗━2015       (1)
   5     ┃ ┗━05       (10) <- invalid/mirrored
   6   ┣━Drafts       (0)

Should be:

   0  testing_account (0)
   1   ┣━Archives     (0)
   2   ┃ ┣━2014       (1)
   3   ┃ ┃ ┗━10       (11)
   4   ┃ ┗━2015       (1)
   5   ┃   ┗━05       (10)
   6   ┣━Drafts       (0)
jmap-eventsource
Manos Pitsidianakis 2020-11-11 16:17:27 +02:00
parent aa7ebf2918
commit aa73bd71c3
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
2 changed files with 4 additions and 4 deletions

View File

@ -1652,15 +1652,15 @@ impl Listing {
{
branches.clear();
branches.push_str(no_sibling_str);
let mut o = 1;
let leading_zeros = indentation.leading_zeros();
for _ in 0..(30_u32.saturating_sub(leading_zeros)) {
let mut o = 1_u32.wrapping_shl(31_u32.saturating_sub(leading_zeros));
for _ in 0..(32_u32.saturating_sub(leading_zeros)) {
if indentation & o > 0 {
branches.push_str(has_sibling_str);
} else {
branches.push_str(no_sibling_str);
}
o <<= 1;
o >>= 1;
}
if depth > 0 {
if has_sibling {

View File

@ -2310,6 +2310,6 @@ fn build_mailboxes_order(
}
};
rec(node, &mailbox_entries, 0, 1, false);
rec(node, &mailbox_entries, 0, 0, false);
}
}