From 887bf0a744646c6d9cfb361ba0c929d4a4342337 Mon Sep 17 00:00:00 2001 From: sigoden Date: Fri, 3 Nov 2023 18:36:17 +0800 Subject: fix: fix rendering markdown in REPL (#207) --- src/render/markdown.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/render/markdown.rs') diff --git a/src/render/markdown.rs b/src/render/markdown.rs index f491fc1..f300854 100644 --- a/src/render/markdown.rs +++ b/src/render/markdown.rs @@ -205,7 +205,9 @@ impl MarkdownRender { fn wrap(text: &str, width: usize) -> String { let indent: usize = text.chars().take_while(|c| *c == ' ').count(); - let wrap_options = textwrap::Options::new(width).initial_indent(&text[0..indent]); + let wrap_options = textwrap::Options::new(width) + .wrap_algorithm(textwrap::WrapAlgorithm::FirstFit) + .initial_indent(&text[0..indent]); textwrap::wrap(&text[indent..], wrap_options).join("\n") } -- cgit v1.2.3