Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ui: Add `text center` method to label (#65210)
Danilo Leal2239fa76b1f3
diff --git a/crates/ui/src/components/label/label.rs b/crates/ui/src/components/label/label.rsindex fe3ab1923e4..22dc2628777 100644--- a/crates/ui/src/components/label/label.rs+++ b/crates/ui/src/components/label/label.rs@@ -3,7 +3,7 @@ use std::ops::Range;use crate::utils::replace_control_characters;use crate::{LabelLike, prelude::*};-use gpui::{HighlightStyle, StyleRefinement, StyledText};+use gpui::{HighlightStyle, StyleRefinement, StyledText, TextAlign};/// A struct representing a label element in the UI.///@@ -100,6 +100,11 @@ impl Label {visibility: pub});+ pub fn text_center(mut self) -> Self {+ self.style().text.text_align = Some(TextAlign::Center);+ self+ }+pub fn flex_1(mut self) -> Self {self.style().flex_grow = Some(1.);self.style().flex_shrink = Some(1.);