gpui: Impl Default for TextRun (#41084)

Release Notes:

- N/A

When I was implementing Input, I often used `TextRun`, but `background`,
`underline` and `strikethrough` were often not used.

So make change to simplify it.
This commit is contained in:
Jason Lee
2025-11-06 01:50:23 +00:00
committed by GitHub
parent 622d626a29
commit 64c8c19e1b
5 changed files with 27 additions and 62 deletions
+4 -13
View File
@@ -315,9 +315,7 @@ impl Boundary {
#[cfg(test)]
mod tests {
use super::*;
use crate::{
Font, FontFeatures, FontStyle, FontWeight, Hsla, TestAppContext, TestDispatcher, font,
};
use crate::{Font, FontFeatures, FontStyle, FontWeight, TestAppContext, TestDispatcher, font};
#[cfg(target_os = "macos")]
use crate::{TextRun, WindowTextSystem, WrapBoundary};
use rand::prelude::*;
@@ -341,10 +339,7 @@ mod tests {
weight: FontWeight::default(),
style: FontStyle::Normal,
},
color: Hsla::default(),
background_color: None,
underline: None,
strikethrough: None,
..Default::default()
})
.collect()
}
@@ -691,16 +686,12 @@ mod tests {
font: font("Helvetica"),
color: Default::default(),
underline: Default::default(),
strikethrough: None,
background_color: None,
..Default::default()
};
let bold = TextRun {
len: 0,
font: font("Helvetica").bold(),
color: Default::default(),
underline: Default::default(),
strikethrough: None,
background_color: None,
..Default::default()
};
let text = "aa bbb cccc ddddd eeee".into();