fix: uncorrected render in command mode (#188)

pull/189/head
sigoden 11 months ago committed by GitHub
parent 680670e834
commit 9b614600c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -43,10 +43,12 @@ pub fn cmd_render_stream(
let output = render.render(&input);
let output = &output[col..];
let (_, tail) = split_line_tail(output);
if output.contains('\n') {
col = display_width(tail);
} else {
col += display_width(output);
if render.wrap_width().is_some() {
if output.contains('\n') {
col = display_width(tail);
} else {
col += display_width(output);
}
}
print_now!("{}", output);
}

@ -71,6 +71,10 @@ impl MarkdownRender {
)
}
pub(crate) const fn wrap_width(&self) -> Option<u16> {
self.wrap_width
}
pub fn render(&mut self, text: &str) -> String {
text.split('\n')
.map(|line| self.render_line_mut(line))

Loading…
Cancel
Save