fix: pr body scrolling

This commit is contained in:
2026-05-11 02:14:05 +08:00
parent 5d741f39eb
commit 6c0283d7a3
3 changed files with 51 additions and 25 deletions

View File

@@ -507,7 +507,6 @@ impl gpui::Render for MarkdownText {
_window: &mut gpui::Window,
cx: &mut gpui::prelude::Context<Self>,
) -> impl gpui::prelude::IntoElement {
let theme = app::current_theme(cx);
let children = self.blocks.iter().enumerate().map(|(i, block)| {
match block {
| ContentBlock::Text {
@@ -520,13 +519,8 @@ impl gpui::Render for MarkdownText {
let styled_text =
gpui::StyledText::new(text.clone()).with_highlights(highlights.clone());
let div = decoration
.map(|d| div().flex().flex_row().gap_2().items_start().child(d))
.unwrap_or_else(|| div());
let mut div = if links.is_empty() {
// if no link in block, interactive text is not needed
div.child(styled_text)
let content = if links.is_empty() {
div().w_full().child(styled_text)
} else {
// if link in block, interactive text is needed
// to handle link clicks
@@ -545,7 +539,19 @@ impl gpui::Render for MarkdownText {
},
);
div.child(t)
div().w_full().child(t)
};
let mut div = match decoration {
| Some(d) => div()
.w_full()
.flex()
.flex_row()
.gap_2()
.items_start()
.child(*d)
.child(div().flex_1().min_w_0().child(content)),
| None => div().w_full().child(content),
};
div.style().refine(&style);
@@ -555,6 +561,6 @@ impl gpui::Render for MarkdownText {
}
});
div().flex().flex_col().children(children)
div().w_full().children(children)
}
}