Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
markdown: Render soft breaks as line breaks in agent markdown (#57376)
Ted Robertsonfe22af1e6e95
diff --git a/crates/markdown/src/markdown.rs b/crates/markdown/src/markdown.rsindex 464a6e757fc..9b61d322f01 100644--- a/crates/markdown/src/markdown.rs+++ b/crates/markdown/src/markdown.rs@@ -112,6 +112,7 @@ pub struct MarkdownStyle {pub height_is_multiple_of_line_height: bool,pub prevent_mouse_interaction: bool,pub table_columns_min_size: bool,+ pub soft_break_as_hard_break: bool,}impl Default for MarkdownStyle {@@ -136,6 +137,7 @@ impl Default for MarkdownStyle {height_is_multiple_of_line_height: false,prevent_mouse_interaction: false,table_columns_min_size: false,+ soft_break_as_hard_break: false,}}}@@ -271,6 +273,7 @@ impl MarkdownStyle {}),..Default::default()},+ soft_break_as_hard_break: matches!(font, MarkdownFont::Agent),heading_level_styles: matches!(font, MarkdownFont::Agent).then_some(HeadingLevelStyles {h1: Some(TextStyleRefinement {@@ -2628,7 +2631,13 @@ impl Element for MarkdownElement {);builder.pop_div()}- MarkdownEvent::SoftBreak => builder.push_text(" ", range.clone()),+ MarkdownEvent::SoftBreak => {+ if self.style.soft_break_as_hard_break {+ builder.push_text("\n", range.clone())+ } else {+ builder.push_text(" ", range.clone())+ }+ }MarkdownEvent::HardBreak => builder.push_text("\n", range.clone()),MarkdownEvent::TaskListMarker(_) => {// handled inside the `MarkdownTag::Item` case