mirror of
https://github.com/sigoden/aichat
synced 2024-11-18 09:28:27 +00:00
chore: recovery cursor in case of stream abort
This commit is contained in:
parent
865fb49af9
commit
54e6edbf21
@ -70,11 +70,16 @@ fn repl_render_stream_inner(
|
||||
}
|
||||
ReplyStreamEvent::Done => {
|
||||
let output = markdown_render.render_line_stateless(&buffer);
|
||||
queue!(writer, style::Print(output.trim_end()), style::Print("\n"))?;
|
||||
if cfg!(windows) {
|
||||
queue!(writer, style::Print("\n"))?;
|
||||
let trimed_output = output.trim_end();
|
||||
if !trimed_output.is_empty() {
|
||||
queue!(writer, style::Print(output.trim_end()))?;
|
||||
writer.flush()?;
|
||||
}
|
||||
|
||||
let (_, row) = cursor::position()?;
|
||||
queue!(writer, cursor::MoveTo(0, row), style::Print("\n\n"))?;
|
||||
writer.flush()?;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user