Merge branch 'main' into zed2-breadcrumbs
This commit is contained in:
commit
13f4cc563c
58 changed files with 2606 additions and 3167 deletions
|
@ -166,7 +166,6 @@ impl TextState {
|
|||
runs: Option<Vec<TextRun>>,
|
||||
cx: &mut WindowContext,
|
||||
) -> LayoutId {
|
||||
let text_system = cx.text_system().clone();
|
||||
let text_style = cx.text_style();
|
||||
let font_size = text_style.font_size.to_pixels(cx.rem_size());
|
||||
let line_height = text_style
|
||||
|
@ -174,18 +173,16 @@ impl TextState {
|
|||
.to_pixels(font_size.into(), cx.rem_size());
|
||||
let text = SharedString::from(text);
|
||||
|
||||
let rem_size = cx.rem_size();
|
||||
|
||||
let runs = if let Some(runs) = runs {
|
||||
runs
|
||||
} else {
|
||||
vec![text_style.to_run(text.len())]
|
||||
};
|
||||
|
||||
let layout_id = cx.request_measured_layout(Default::default(), rem_size, {
|
||||
let layout_id = cx.request_measured_layout(Default::default(), {
|
||||
let element_state = self.clone();
|
||||
|
||||
move |known_dimensions, available_space| {
|
||||
move |known_dimensions, available_space, cx| {
|
||||
let wrap_width = if text_style.white_space == WhiteSpace::Normal {
|
||||
known_dimensions.width.or(match available_space.width {
|
||||
crate::AvailableSpace::Definite(x) => Some(x),
|
||||
|
@ -203,7 +200,8 @@ impl TextState {
|
|||
}
|
||||
}
|
||||
|
||||
let Some(lines) = text_system
|
||||
let Some(lines) = cx
|
||||
.text_system()
|
||||
.shape_text(
|
||||
&text, font_size, &runs, wrap_width, // Wrap if we know the width.
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue