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