mirror of
https://github.com/sigoden/aichat
synced 2024-11-13 19:10:59 +00:00
fix: uncorrected render in command mode (#188)
This commit is contained in:
parent
680670e834
commit
9b614600c6
@ -43,11 +43,13 @@ pub fn cmd_render_stream(
|
||||
let output = render.render(&input);
|
||||
let output = &output[col..];
|
||||
let (_, tail) = split_line_tail(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…
Reference in New Issue
Block a user