term: Fix spinner output on certain platforms

This commit is contained in:
cloudhead 2024-03-26 13:13:54 +01:00
parent f01aac8828
commit aaea06dd98
No known key found for this signature in database
1 changed files with 6 additions and 4 deletions

View File

@ -143,8 +143,8 @@ pub fn spinner_to(
write!(
animation,
"{}{spinner} {message}\r",
termion::clear::AfterCursor,
"\r{}{spinner} {message}",
termion::clear::UntilNewline,
)
.ok();
@ -155,7 +155,7 @@ pub fn spinner_to(
state: State::Done,
message,
} => {
write!(animation, "{}", termion::clear::AfterCursor).ok();
write!(animation, "\r{}", termion::clear::UntilNewline).ok();
writeln!(completion, "{} {message}", Paint::green("")).ok();
break;
}
@ -163,7 +163,7 @@ pub fn spinner_to(
state: State::Canceled,
message,
} => {
write!(animation, "{}", termion::clear::AfterCursor).ok();
write!(animation, "\r{}", termion::clear::UntilNewline).ok();
writeln!(
completion,
"{ERROR_PREFIX} {message} {}",
@ -176,6 +176,7 @@ pub fn spinner_to(
state: State::Warn,
message,
} => {
write!(animation, "\r{}", termion::clear::UntilNewline).ok();
writeln!(completion, "{WARNING_PREFIX} {message}").ok();
break;
}
@ -183,6 +184,7 @@ pub fn spinner_to(
state: State::Error,
message,
} => {
write!(animation, "\r{}", termion::clear::UntilNewline).ok();
writeln!(completion, "{ERROR_PREFIX} {message}").ok();
break;
}