Comments (29)
elegant-spinner
looks lovely, but I don't believe the brail blocks it uses are available across our supported environments. I looked at using them myself when I was first selecting characters for the spinner. (We already have an outstanding issue just for the darn solid block █
), which is in the "is it double width? who knows" unicode classification, which means some settings can break everything. =/ Even just here on github, it's single-width in the fixed width font and double-width with the proportional font.
I kind of like the blobbyness of the current spinner, but I'm totally open to a replacement. What a replacement needs to do is, display correctly by default in the following environments:
- Windows cmd
- Windows powershell
- Windows gitbash
- Ubuntu Terminal
- Mac Terminal
- Mac iTerm2
- and ideally, Mac iTerm2 with "Treat ambiguous-width characters as double width" enabled
from gauge.
On my mind, btw, is a gauge@2 with better templating. At the same time it might be handy to have more than "unicode" and "ascii" for detected template types, so we can have more expressive characters on OSes that support it.
from gauge.
I just found cli-spinner which looks great. I think a few of them should work everywhere.
from gauge.
I'm aware of it– and unfortunately IIRC, the answer is "almost none of them".
I'm not taking anything without actually testing them on all of the platforms listed.
Or... I actually took ALL of the unicode line drawing-ish characters and tried them on all of those platforms and had prepared a list of the one's that work. Unfortunately I seem to have been all cute and only recorded them in a tweet, finding it will take longer.
from gauge.
Found it! Ok, so this is (I believe) a complete list of characters that work across platforms:
←↑↓↔↕─│┌┐└┘├┬┼═║╒╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡╢╣╤╥╦╧╨╩╪╫╬▀▄▌▐░▒▓■▬▲►▼◄◊○◘◙
Any spinner has to come from these or from the Unicode "basic latin" set.
from gauge.
You'll note annoyances, like the fat arrows are thinner sideways than up and down. Also that there's no rightward version of ← (I mean, there is →, but it's not supported on all platforms).
from gauge.
The original version of this module used ◐◓◑◒
, which I think looks pretty keen but does not work everywhere. =/
Of those example spinners the following can work:
|/-\
┤┘┴└├┌┬┐
.oO°Oo.
(maybe, untested).oO@*
The first is the ascii spinner we already have. And I think 3 + 4 are pretty ugly =/
I'm be curious about seeing 2 in motion.
from gauge.
I don't think the "ambiguous-width characters" option is supported as of yet? At least with the latest version of NPM and iTerm2.
from gauge.
At the same time it might be handy to have more than "unicode" and "ascii" for detected template types
The Windows shell uses the CP437 character encoding, so that could be another type? (https://en.wikipedia.org/wiki/Code_page_437)
We could show the elegant spinner for full Unicode supported shells, the current unicode template for CP437 Windows shells and the ASCII template for non-unicode shells.
I'll play around for a bit with my own fork of Gauge to look into extending the character encoding detection.
EDIT: Testing this indicates that CP437 is more commonly the default character set.
from gauge.
I've taken the liberty of testing some of my changes on the platforms that are available to me right now using three different themes:
- cp437
- unicode
- ascii
I've created an album to showcase all of the different rendering possibilities http://imgur.com/a/5UcqW
So far, my tests include:
Terminal and iTerm on OSX — mostly using zshell and some with bash to show that the shell isn't really influencing the rendering
cmd and the Git cmd on Windows, using whatever the default settings are for both.
I'll do some more tests on Linux and in Windows (Powershell mainly) when I have some more time on my hands.
from gauge.
When I last tried on Linux (Ubuntu), the brail code blocks weren't available in the default terminal fonts, but time does march on.
from gauge.
Ultimately I do think the fix for this is to allow templates to be specified not just for unicode and ascii, but for different OSes too, so Unicode + Mac can make use of everything, and the others can get a cut down version appropriate to their character sets.
from gauge.
I've looked around for some modules that detect the available character set, but no luck. I'm also going off of the assumption that Windows only supports cp437 — even though it can support the full unicode range if it's set up properly.
from gauge.
I don't think the "ambiguous-width characters" option is supported as of yet? At least with the latest version of NPM and iTerm2.
I'm not sure what you mean? My understanding is that making "ambiguous-width characters" be double spaced currently breaks everything, because the solid block character is rendered as two spaces.
from gauge.
(Yeah, even determining unicode is a pain, let alone font character availability.)
from gauge.
Re: ambiguous-width characters this is the behaviour I'm seeing, could totally be blamed on my iTerm nightly build though.
from gauge.
That looks like what I'd expect from it, yeah. =/
from gauge.
I've updated the album to include Powershell on Windows and Terminal and XTerm on Ubuntu 14.04 LTS.
I'm not sure how far back we want to support Ubuntu, maybe this particular issue warrants taking a look at some older distros?
from gauge.
So, as npm/npm#10648 points out, we don't really have control over what codepage Windows users are using. I've seen enough other issues from people using npm in a CJKV environment to lead me to believe that we probably need to only use characters that are guaranteed to be the same (half) width, regardless of codepage or encoding.
from gauge.
I'd like to pick up where I left off at this issue. I'll run some tests using other code pages on Windows.
Should we consider going full ASCII for Windows machines? I'm assuming Windows is the only platform where multi-lingual support is problematic?
from gauge.
Yeah, I'm of the opinion we should go full ASCII on windows, and let users via configuration select a prettier display if that's what they want.
from gauge.
Regarding full-width characters, this is what Wikipedia has to say:
Range U+FF01–FF5E reproduces the characters of ASCII 21 to 7E as fullwidth forms, that is, a fixed width form used in CJK computing.
So we can typeset those characters properly in CJK text. The output looks to be correct after changing my system language and switching to a CJK code page.
Any ideas on how the user might configure a different spinner, does such an option already exist?
from gauge.
It's not double width characters per se that are the concern. It's ambiguous width characters, that some terminals treat as double width and some treat as single width. Without knowing how wide the character will be displayed as, there's no way to correctly layout a line.
from gauge.
Correct, but as long as we stay within the ASCII range, we can assume that every terminal will treat it as either half-width for non-East-Asian character sets and full-width for East-Asian character sets.
from gauge.
If we stay in the ASCII range we can assume every terminal will treat all of that as half width. East Asian code pages have a different set of codepoints for full width characters.
You'll note in your example above that everything is half width except the arrow.
from gauge.
As I said earlier, my intent for fixing this is:
Ultimately I do think the fix for this is to allow templates to be specified not just for unicode and ascii, but for different OSes too, so Unicode + Mac can make use of everything, and the others can get a cut down version appropriate to their character sets.
So specifically, for Windows it'll get ASCII as we have no way of determining support, Linux will get something closer to what we have today, and Mac can have a much richer result.
I have a rewrite in process that I'll be ready to share with you all in the next week or two, probably.
from gauge.
I've done a little research into how to support windows and it means either a system call, which is out due to it requiring C, or a call out to a command line tool, which might be the right answer for some applications but is, I think, out of scope for gauge.
from gauge.
My in progress branch (with lots of unsquashed wip commits) is here: https://github.com/iarna/gauge/tree/new-rewrite
from gauge.
So this work has landed in master and is out as gauge@2
with a beta tag– you can install it by explicitly asking for the version or installing gauge@beta
.
Now is the time for figuring this out! It can select different themes based on your OS, so OSX users can get a much richer set of unicode.
Please join me in the bikeshedding issue to hash things out:
https://github.com/iarna/gauge/issues/36
(I'm closing this issue in favor of that one.)
from gauge.
Related Issues (20)
- New line before progress bar? HOT 6
- Disable if running in CI HOT 1
- Misspelling in Description, should be "gauge"
- Progress bar theme set to 'fallback' regardless of unicode locale on Fedora Linux HOT 5
- Make new release HOT 2
- npm does not store tarball URL in lockfile
- [BUG] Cannot find module 'object-assign' HOT 2
- [FEATURE] Dependencies should be updated to dedupe the tree for npm HOT 2
- [Question] Upgrade Dependencies to fix Vulnerability HOT 16
- [BUG] Themes no longer work from require
- Reporting a vulnerability HOT 1
- Image in readme is out of date!! HOT 1
- Help me bikeshed the gauge look HOT 15
- every time I use it, I expect show to pulse too HOT 1
- Display corruption on node 0.10/0.12 on Windows
- Progress bar not color with invert ansi/vt100 code in cmd.exe
- Temporary files on npm release HOT 4
- Am I using gauge wrong?
- MaxListenersExceededWarning HOT 4
- TypeError: Object.keys called on non-object HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gauge.