Fix markdown preview heading overflows no wrap (#8052)

![Kapture 2024-02-20 at 18 27
15](https://github.com/zed-industries/zed/assets/8416130/87d4dcea-e2f0-44ba-88a4-06829dbb0e89)

Release Notes:

- Improved markdown preview wrapping ([#8047](https://github.com/zed-industries/zed/issues/8047)).
This commit is contained in:
Hourann 2024-02-20 21:18:42 +08:00 committed by GitHub
parent c54d6aff6c
commit 6c714c13b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,7 +8,10 @@ use gpui::{
HighlightStyle, Hsla, InteractiveText, IntoElement, ParentElement, SharedString, Styled, HighlightStyle, Hsla, InteractiveText, IntoElement, ParentElement, SharedString, Styled,
StyledText, TextStyle, WeakView, WindowContext, StyledText, TextStyle, WeakView, WindowContext,
}; };
use std::{ops::Range, sync::Arc}; use std::{
ops::{Mul, Range},
sync::Arc,
};
use theme::{ActiveTheme, SyntaxTheme}; use theme::{ActiveTheme, SyntaxTheme};
use ui::{h_flex, v_flex, Label}; use ui::{h_flex, v_flex, Label};
use workspace::Workspace; use workspace::Workspace;
@ -115,7 +118,7 @@ fn render_markdown_heading(parsed: &ParsedMarkdownHeading, cx: &mut RenderContex
_ => cx.text_color, _ => cx.text_color,
}; };
let line_height = DefiniteLength::from(rems(1.25)); let line_height = DefiniteLength::from(size.mul(1.25));
div() div()
.line_height(line_height) .line_height(line_height)
@ -124,6 +127,7 @@ fn render_markdown_heading(parsed: &ParsedMarkdownHeading, cx: &mut RenderContex
.pt(rems(0.15)) .pt(rems(0.15))
.pb_1() .pb_1()
.child(render_markdown_text(&parsed.contents, cx)) .child(render_markdown_text(&parsed.contents, cx))
.whitespace_normal()
.into_any() .into_any()
} }