From 9e26253b167ab4ae22a81f7a0024375a21fb97ea Mon Sep 17 00:00:00 2001 From: Nikita Revenco <154856872+NikitaRevenco@users.noreply.github.com> Date: Mon, 27 Jan 2025 22:03:04 +0000 Subject: [PATCH] feat: implement line breaks for custom helix renderer --- helix-term/src/ui/markdown.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs index 16487170b..470c3b224 100644 --- a/helix-term/src/ui/markdown.rs +++ b/helix-term/src/ui/markdown.rs @@ -115,7 +115,12 @@ pub fn highlighted_code_block<'a>( style_text }; - spans.push(Span::styled(ch.to_string(), style)); + if ch == '\n' { + lines.push(Spans::from(spans)); + spans = vec![]; + } else { + spans.push(Span::styled(ch.to_string(), style)); + } } } else { let mut highlights = Vec::new();