Displaying two spinners together
Hi there!
I'm currently building a project where I need to show two spinners for two different long-running tasks.
Is there a way to achieve this?
Thanks in advance for your help!
It is doable, however the tricky part is stopping them. The library was initially designed for only one spinner to be run at a time, so if you would want to stop the first spinner before the second one, it would stop the second one instead. This is because "stopping" the spinner in the code is effectively just deleting the last line and rewriting it without the spinner.
I think in this use case there could be a work around (maybe doing some print!("\r") stuff, I'm not entirely sure), I could look into it in my free time.
That would in fact require to move the cursor manually using a library like crossterm.
I opened this issue as I didn't know how the internal crate worked but if it's just a line rewrite currently it's a bit of work to make two spinners (or more) work together.
The good point being that if two spinners can be displayed together then si can be three, four, five etc.
I dont think a library like crossterm is needed.
you can get the term position printing "\033[6n" and reading from input "^[[row;columnR".
Save the position you get, and always go to that position when printing.
@ad4mx Can I take a crack at it? I'm seeing if we can use an mpsc to output spinners from multiple threads into one stream.
@ad4mx Can I take a crack at it? I'm seeing if we can use an
mpscto output spinners from multiple threads into one stream.
Of course.