diff options
author | 2024-09-13 01:20:25 +0200 | |
---|---|---|
committer | 2024-09-13 01:20:25 +0200 | |
commit | 295aae4faad7c151fa9d96c9c352264d14a9fcfe (patch) | |
tree | 867fc97904dbbebaed1fa3cde83af05b34e76411 /widget | |
parent | f392f4ac87867e2665c20e3ceaa3f15b1a4d4755 (diff) | |
parent | 7c7e94c8d1f9b843ab6d828f0976becbb447ba6e (diff) | |
download | iced-295aae4faad7c151fa9d96c9c352264d14a9fcfe.tar.gz iced-295aae4faad7c151fa9d96c9c352264d14a9fcfe.tar.bz2 iced-295aae4faad7c151fa9d96c9c352264d14a9fcfe.zip |
Merge pull request #2513 from ayeniswe/feat/set-width_text-editor
feat: add width setter for Text-Editor widget
Diffstat (limited to '')
-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(), |