dominicegginton / spinner

Powerful Swift CLI Spinners
MIT License
45 stars 5 forks source link

Completion functions render incorrectly when paired with custom format #21

Closed dominicegginton closed 5 years ago

dominicegginton commented 5 years ago

Steps to reproduce

If a spinner has a custom completion type with the animated pattern rendering after the text and a completion function is used to stop the spinner, a render error can occur if the passed text is shorter than the original. I am assuming this will occur when updating the text too.

let mySpinner = Spinner(.dots, "My Spinner", format: "{T} {S}")
mySpinner.start()
sleep(2)
mySpinner.failure("Fail")

Expected behavior

This should render final completion frame next to the text

Actual behavior

This renders the final completion frame with space between the text and the spinner

Environment