Merge pull request #2513 from ayeniswe/feat/set-width_text-editor
feat: add width setter for Text-Editor widget
This commit is contained in:
commit
295aae4faa
1 changed files with 7 additions and 1 deletions
|
|
@ -109,6 +109,12 @@ where
|
||||||
self
|
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
|
/// Sets the message that should be produced when some action is performed in
|
||||||
/// the [`TextEditor`].
|
/// the [`TextEditor`].
|
||||||
///
|
///
|
||||||
|
|
@ -498,7 +504,7 @@ where
|
||||||
state.highlighter_settings = self.highlighter_settings.clone();
|
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(
|
internal.editor.update(
|
||||||
limits.shrink(self.padding).max(),
|
limits.shrink(self.padding).max(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue