From 2ba73b0faf04c21053f279e7c189b28ca718d853 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 7 Feb 2024 21:48:28 +0100 Subject: Fix wrapped lines not being considered when measuring `TextEditor` --- core/src/renderer/null.rs | 4 ++++ core/src/text/editor.rs | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'core') diff --git a/core/src/renderer/null.rs b/core/src/renderer/null.rs index 75a3c8b6..83688ff7 100644 --- a/core/src/renderer/null.rs +++ b/core/src/renderer/null.rs @@ -150,6 +150,10 @@ impl text::Editor for () { Size::ZERO } + fn min_bounds(&self) -> Size { + Size::ZERO + } + fn update( &mut self, _new_bounds: Size, diff --git a/core/src/text/editor.rs b/core/src/text/editor.rs index f3c6e342..fbf60696 100644 --- a/core/src/text/editor.rs +++ b/core/src/text/editor.rs @@ -36,6 +36,10 @@ pub trait Editor: Sized + Default { /// Returns the current boundaries of the [`Editor`]. fn bounds(&self) -> Size; + /// Returns the minimum boundaries to fit the current contents of + /// the [`Editor`]. + fn min_bounds(&self) -> Size; + /// Updates the [`Editor`] with some new attributes. fn update( &mut self, -- cgit