diff options
Diffstat (limited to 'widget')
-rw-r--r-- | widget/src/text_editor.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs index e0102656..5b565c39 100644 --- a/widget/src/text_editor.rs +++ b/widget/src/text_editor.rs @@ -109,6 +109,12 @@ where self } + /// Sets the width of the [`TextEditor`]. + pub fn width(mut self, width: impl Into<Pixels>) -> Self { + self.width = Length::from(width.into()); + self + } + /// Sets the message that should be produced when some action is performed in /// the [`TextEditor`]. /// @@ -498,7 +504,7 @@ where state.highlighter_settings = self.highlighter_settings.clone(); } - let limits = limits.height(self.height); + let limits = limits.width(self.width).height(self.height); internal.editor.update( limits.shrink(self.padding).max(), |