diff --git a/crates/gpui2/src/elements/text.rs b/crates/gpui2/src/elements/text.rs index e258d3e7dc6dba8c7d7c625981b7ef340c1dc96c..5c5709d32e5a12e247726789a35dfd21806c6c7c 100644 --- a/crates/gpui2/src/elements/text.rs +++ b/crates/gpui2/src/elements/text.rs @@ -101,7 +101,12 @@ impl Element for Text { .map(|line| line.wrap_count() + 1) .sum::(); let size = Size { - width: lines.iter().map(|line| line.layout.width).max().unwrap(), + width: lines + .iter() + .map(|line| line.layout.width) + .max() + .unwrap() + .ceil(), height: line_height * line_count, }; diff --git a/crates/gpui2/src/geometry.rs b/crates/gpui2/src/geometry.rs index f290c6a81c1b147c78940465e6fa2ffb63c9964f..e07300951ec61429ba617927649406409e74b531 100644 --- a/crates/gpui2/src/geometry.rs +++ b/crates/gpui2/src/geometry.rs @@ -785,6 +785,10 @@ impl Pixels { Self(self.0.round()) } + pub fn ceil(&self) -> Self { + Self(self.0.ceil()) + } + pub fn scale(&self, factor: f32) -> ScaledPixels { ScaledPixels(self.0 * factor) }