diff --git a/src/component/markdown.rs b/src/component/markdown.rs index c5ffd4f..9807a6f 100644 --- a/src/component/markdown.rs +++ b/src/component/markdown.rs @@ -114,7 +114,6 @@ enum ContentBlock { }, Empty, Table { - row_count: usize, col_count: usize, cells: Vec, }, @@ -598,7 +597,6 @@ impl MarkdownText { // the table consists of only the header row self.blocks.push(ContentBlock::Table { - row_count, col_count, cells: cell_blocks, }); @@ -690,21 +688,19 @@ impl gpui::Render for MarkdownText { .child(content.clone()), | ContentBlock::Table { - row_count, - col_count, - cells, + col_count, cells, .. } => div().flex().w_full().child( div() .w_full() + .min_w_0() .grid() .grid_cols(*col_count as u16) - .grid_rows(*row_count as u16) - .h_40() .border_l_1() .border_t_1() .border_color(theme.colors.border_muted) .children(cells.iter().map(|cell_content| { div() + .min_w_0() .p_1() .border_r_1() .border_b_1() diff --git a/src/component/rich_text.rs b/src/component/rich_text.rs index f8eaa92..fc14c34 100644 --- a/src/component/rich_text.rs +++ b/src/component/rich_text.rs @@ -177,20 +177,23 @@ impl gpui::RenderOnce for RichText { let styled_text = gpui::StyledText::new(content).with_highlights(highlights.into_iter().cloned()); if links.is_empty() { - styled_text.into_any_element() + div().min_w_0().whitespace_normal().child(styled_text) } else { let on_click = self.on_click.as_ref().map(Rc::clone); let all_links = Rc::clone(&self.content.links); let link_i_offset = *link_i_offset; - gpui::InteractiveText::new(i, styled_text) - .on_click(links.clone(), move |i, window, cx| { - if let Some(f) = &on_click { - let link = all_links[i + link_i_offset].clone(); - f(&RichTextClickTarget::Link(link), window, cx); - } - }) - .into_any_element() + div().min_w_0().whitespace_normal().child( + gpui::InteractiveText::new(i, styled_text).on_click( + links.clone(), + move |i, window, cx| { + if let Some(f) = &on_click { + let link = all_links[i + link_i_offset].clone(); + f(&RichTextClickTarget::Link(link), window, cx); + } + }, + ), + ) } } | RichTextElement::Image { src, description } => todo!(), @@ -200,6 +203,10 @@ impl gpui::RenderOnce for RichText { .flex() .flex_row() .flex_wrap() + .items_start() + .w_full() + .min_w_0() + .whitespace_normal() .text_color(theme.colors.text) .children(children) }