From 7388dba319ace0132f232aa9fc0db0a1d23e2e94 Mon Sep 17 00:00:00 2001 From: Kevin Boos Date: Mon, 23 Sep 2024 01:19:32 +0200 Subject: [PATCH] Speed up searching for the timeline index of the replied-to message Use `Vector::focus()` with reverse iteration from the current reply message, searching backwards since the replied-to message must come before the reply message --- src/home/room_screen.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/home/room_screen.rs b/src/home/room_screen.rs index 47da37a2..3e885a4d 100644 --- a/src/home/room_screen.rs +++ b/src/home/room_screen.rs @@ -1118,7 +1118,7 @@ impl Widget for RoomScreen { .into_iter() .rposition(|i| i.as_event() .and_then(|e| e.event_id()) - .map_or(false, |ev_id| ev_id == details.event_id) + .is_some_and(|ev_id| ev_id == details.event_id) ); if let Some(index) = replied_to_msg_tl_index {