Skip to content

Commit

Permalink
fix: uncorrected render in command mode
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden committed Oct 31, 2023
1 parent 680670e commit e1b1de7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/render/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions src/render/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit e1b1de7

Please sign in to comment.