diff --git a/crates/epaint/src/text/text_layout_types.rs b/crates/epaint/src/text/text_layout_types.rs index 5ae784468..97af735b4 100644 --- a/crates/epaint/src/text/text_layout_types.rs +++ b/crates/epaint/src/text/text_layout_types.rs @@ -114,6 +114,13 @@ impl Default for LayoutJob { } impl LayoutJob { + /// Clear the text and sections while preserving the layout settings. + #[inline] + pub fn clear(&mut self) { + self.text.clear(); + self.sections.clear(); + } + /// Break on `\n` and at the given wrap width. #[inline] pub fn simple(text: String, font_id: FontId, color: Color32, wrap_width: f32) -> Self {