diff --git a/crates/ui/src/components/label/label.rs b/crates/ui/src/components/label/label.rs index 5ec557d7e69fa0a81524094cc7d447aab426c5a6..a2034ff8ae0671ea15dbb4b7d5529f98f561a01d 100644 --- a/crates/ui/src/components/label/label.rs +++ b/crates/ui/src/components/label/label.rs @@ -36,7 +36,6 @@ use crate::{prelude::*, LabelCommon, LabelLike, LabelSize, LineHeightStyle}; pub struct Label { base: LabelLike, label: SharedString, - single_line: bool, } impl Label { @@ -53,7 +52,6 @@ impl Label { Self { base: LabelLike::new(), label: label.into(), - single_line: false, } } } @@ -170,7 +168,7 @@ impl LabelCommon for Label { } fn single_line(mut self) -> Self { - self.single_line = true; + self.label = SharedString::from(self.label.replace('\n', "␤")); self.base = self.base.single_line(); self } @@ -178,11 +176,6 @@ impl LabelCommon for Label { impl RenderOnce for Label { fn render(self, _cx: &mut WindowContext) -> impl IntoElement { - let target_label = if self.single_line { - SharedString::from(self.label.replace('\n', "␤")) - } else { - self.label - }; - self.base.child(target_label) + self.base.child(self.label) } }