AshlinHarris / Spinners.jl

Command line spinners in Julia with Unicode support
MIT License
14 stars 1 forks source link

Multiple spinners #43

Open AshlinHarris opened 1 year ago

AshlinHarris commented 1 year ago

This could be done with ANSI cursor commands.

AshlinHarris commented 1 year ago

Adding this feature would allow users to reproduce the spinners from Pkg.jl and PackageCompiler.jl.

There should be a Spinner struct that includes style, location, etc.

ANSI escape codes can be used for positioning the cursor.

AshlinHarris commented 1 year ago

As far as I can tell, the Pkg.jl spinners uses REPL.TerminalMenus in order to manage multiple spinners. I can't find a simple and widely-supported way to get the terminal cursor position, I'll use the REPL's terminal menu feature.

In this case, would Julia 1.9's interactive threadpools still be needed for updating a spinner during computation?

AshlinHarris commented 1 year ago

REPL.Terminals.jl's WIP for accessing terminal cursor location:

getX(t::TextTerminal) = error("Unimplemented")
getY(t::TextTerminal) = error("Unimplemented")
AshlinHarris commented 1 year ago

It might be straightforward to create a menu with blank cursors and empty actions. The entire menu would need to be redrawn in the same spot. Additionally, the frame rate might have to be increased so that all spinners won't appear to be in sync.