AshlinHarris / Spinners.jl

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

A few comments #3

Open cormullion opened 1 year ago

cormullion commented 1 year ago

I like this package - it adds a bit of fun and utility to the REPL, which is always welcome!

Although you mention ASCII, I'm thinking Unicode... :) Here are a few spinners that reach further into the dark recesses of Unicode. Fonts will be important...

# if JuliaMono is installed, there are Julia spinner glyphs that have been waiting for this package to appear... :) 
s = join([Char(i) for i in 0xe850:0xe85b])

# if FiraCode, Iosevka, or JuliaMono is installed, you can use
# the Tonsky progress spinner:
# (https://github.com/tonsky/FiraCode/issues/1324#issuecomment-985965631)
s = join([Char(i) for i in 0xee06:0xee0b])

# These general Unicode spinners depend on the font being reasonably Unicode-capable:
s = join([Char(i) for i in 0x4dc0:0x4dff]) # hexagrams
s = join([Char(i) for i in 0x1d306:0x1d356]) # tetragrams
s = join([Char(i) for i in 0x2630:0x2637]) # trigrams
s = "◒◐◓◑" # the Pkg spinner
s = join([Char(i) for i in 0x1d369:0x1d36d]) # vertical lines  
s = join([Char(i) for i in 0x1d360:0x1d364]) # horizontal lines
s = join([Char(i) for i in 0x1fb00:0x1fb3b]) # sextants

Thanks!

AshlinHarris commented 1 year ago

Awesome, these are some really helpful ideas and links! I have a lot of respect for developers who use Julia to make beautiful things.

Some Unicode is already supported by Spinners.jl, with certain limitations. Currently, the package uses transcode length to find the right number of backspaces for clearing a UTF16 character. Also, I'd like to keep features compatible with Windows Terminal, though I might have to give up on that.

I'm not so familiar with the Open Font License, but at the very least I can make sure that this package is compatible with any widely used custom character sets.

AshlinHarris commented 1 year ago

As of #123, Unicode should be fully supported. The package makes use of textwidth and Unicode: graphemes, and I fixed a couple bugs and moved all clean up steps to the spinner process. Now something crazy like @spinner "🎉\u3000დ\u3000@ क़ " runs as intended.