chelnak / ysmrr

YSMRR is a package that provides simple multi-line compatible spinners for Go applications.
MIT License
71 stars 6 forks source link

Fix incorrect line counts #34

Closed chelnak closed 1 year ago

chelnak commented 1 year ago

Prior to this PR, if AddSpinner() was called after Start() and the number of spinners exceeded the lines left on the screen rendering would break. This caused frames to be written to a new line for each frame.

This PR fixes that by ensuring that the screen is buffered inside the processing loop. The result is that we can recalculate the number of lines needed for each render cycle.