From 62c4cc8f267fd756a5daa28d9f3fccb7dd5887c2 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 8 Mar 2024 18:09:47 +0100 Subject: [PATCH] Fix text wrapping issue --- showbits-common/src/widgets/text.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/showbits-common/src/widgets/text.rs b/showbits-common/src/widgets/text.rs index 21f215f..b4d5ca3 100644 --- a/showbits-common/src/widgets/text.rs +++ b/showbits-common/src/widgets/text.rs @@ -111,6 +111,12 @@ impl Widget for Text { .max_by(|a, b| a.partial_cmp(b).unwrap()) .unwrap_or(0.0); + // If we don't round up here, the layout rounding may round down our + // size slightly. This may lead to more line breaks, moving some words + // below our visible area. + let width = width.ceil(); + let height = height.ceil(); + Size { width, height } }