From 63474746335cc087d132df0b02e87f4f02848c65 Mon Sep 17 00:00:00 2001 From: Uncle Stretch Date: Mon, 20 Jan 2025 16:00:58 +0300 Subject: [PATCH] bug with index out-of-range in widget fixed with help of lowest common multiple, thanks to @ogenkidu and @metanomad Signed-off-by: Uncle Stretch --- src/widgets/mod.rs | 2 +- src/widgets/vertical_block.rs | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/widgets/mod.rs b/src/widgets/mod.rs index 6aedfaf..b1edb0c 100644 --- a/src/widgets/mod.rs +++ b/src/widgets/mod.rs @@ -11,4 +11,4 @@ pub use big_text::BigText; pub use big_text::PixelSize; pub use input::{Input, InputRequest}; -const CYCLE: i64 = 1500; +const CYCLE: i64 = 1560; diff --git a/src/widgets/vertical_block.rs b/src/widgets/vertical_block.rs index f7576c9..61034ad 100644 --- a/src/widgets/vertical_block.rs +++ b/src/widgets/vertical_block.rs @@ -14,8 +14,6 @@ impl Default for VerticalBlocks { impl ToString for VerticalBlocks { fn to_string(&self) -> String { - // TODO: how it can be equal to len()?? - // do we really need super::CYCLE in denominator? self.elements[((chrono::Utc::now().timestamp_millis() % super::CYCLE) / (super::CYCLE / self.elements.len() as i64)) as usize] .to_owned()