summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-02-07 22:00:53 +0100
committerLibravatar GitHub <noreply@github.com>2024-02-07 22:00:53 +0100
commit111c8bfa7965cad8fe7253c8601e620b8582eaaf (patch)
tree549936d3630b06eeb6cc3349a38f0bc5bcf92226 /core
parent5630febf963ffcdd9eb1e0e8581a65a08d501467 (diff)
parent4d7356e5e44821402df0531943681a1f3f17d385 (diff)
downloadiced-111c8bfa7965cad8fe7253c8601e620b8582eaaf.tar.gz
iced-111c8bfa7965cad8fe7253c8601e620b8582eaaf.tar.bz2
iced-111c8bfa7965cad8fe7253c8601e620b8582eaaf.zip
Merge pull request #2221 from Dworv/text-shrink
Text editor shrinking to content
Diffstat (limited to 'core')
-rw-r--r--core/src/renderer/null.rs4
-rw-r--r--core/src/text/editor.rs4
2 files changed, 8 insertions, 0 deletions
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,