Allow set_align to clear the alignment by setting it to None

This commit is contained in:
Hojjat 2023-02-24 08:39:24 -07:00
parent 45f6474a74
commit fff8389bbf
2 changed files with 6 additions and 5 deletions

View file

@ -104,10 +104,11 @@ impl BufferLine {
/// Set the text alignment
///
/// Will reset shape and layout if it differs from current alignment.
/// Setting to None will use `Align::Right` for RTL lines, and `Align::Left` for LTR lines.
/// Returns true if the line was reset
pub fn set_align(&mut self, align: Align) -> bool {
if Some(align) != self.align {
self.align = Some(align);
pub fn set_align(&mut self, align: Option<Align>) -> bool {
if align != self.align {
self.align = align;
self.reset_layout();
true
} else {