From e47e175fc584dcf5bea281714510963e59ef8015 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 15 Apr 2024 02:35:00 +0200 Subject: [PATCH] how only the 3 most recent log entries --- src/hud.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hud.rs b/src/hud.rs index 3ba840a..aea4e69 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -426,13 +426,17 @@ fn update_hud( _ => false }} }; - let logs_vec: Vec = log.logs.iter() + let mut logs_vec: Vec = log.logs.iter() .filter(logfilter) .map(|s| if s.sender.is_empty() { format!("{}", s.text) } else { format!("{}: {}", s.sender, s.text) - }).collect(); + }) + .rev() + .take(3) + .collect(); + logs_vec.reverse(); chat.sections[0].value = logs_vec.join("\n"); } log.needs_rerendering = false;