From 6d7cf7fc7ef6bc334dd1d262ad015abc966f3fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sat, 13 Nov 2021 16:00:38 +0100 Subject: [PATCH] timeline: Fix day divider position in list Take into account added dividers to insert them in the right spot. --- src/session/room/timeline.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/session/room/timeline.rs b/src/session/room/timeline.rs index 5359f975..3a4b268f 100644 --- a/src/session/room/timeline.rs +++ b/src/session/room/timeline.rs @@ -179,8 +179,8 @@ impl Timeline { ItemType::DayDivider(date) => Some(date.clone()), _ => None, }); - for (position, date) in divider { - list.insert(position, date); + for (added, (position, date)) in divider.into_iter().enumerate() { + list.insert(position + added, date); } (added + divider_len) as u32