timeline: Fix day divider position in list

Take into account added dividers to insert them in the right spot.
This commit is contained in:
Kévin Commaille 2021-11-13 16:00:38 +01:00 committed by Julian Sparber
parent b93bfe8726
commit 6d7cf7fc7e

View file

@ -179,8 +179,8 @@ impl Timeline {
ItemType::DayDivider(date) => Some(date.clone()), ItemType::DayDivider(date) => Some(date.clone()),
_ => None, _ => None,
}); });
for (position, date) in divider { for (added, (position, date)) in divider.into_iter().enumerate() {
list.insert(position, date); list.insert(position + added, date);
} }
(added + divider_len) as u32 (added + divider_len) as u32