Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colors and wide characters #54

Merged
merged 2 commits into from
Nov 12, 2016
Merged

Colors and wide characters #54

merged 2 commits into from
Nov 12, 2016

Conversation

casey
Copy link
Owner

@casey casey commented Nov 12, 2016

Adds colored output, as well as fixing an error where wide characters such as tabs and chinese characters that take up more than one space.

PRing them together, since they're a little entangled.

This is a pretty gross commit, since it also includes a lot of
unrelated refactoring, especially of how error messages are printed.

Also adds a lint recipe that prints lines over 100 characters

To test, I added a `--color=[auto|always|never]` option that defaults to
auto in normal use, but can be forced to `always` for testing. In `auto`
mode it defers to `atty` to figure out if the current stream is a
terminal and uses color if so.

Color printing is controlled by the `alternate` formatting flag.

When printing an error message, using `{:#}` will print it with colors
and `{}` will print it normally.
Input may contain tabs and other characters whose byte widths do not
correspond to their display widths. This causes error context
underlining to be off when lines contain those characters

Fixed by properly accounting for the display width of characters, as
well as replacing tabs with spaces when printing error messages.
@casey casey merged commit ac76340 into master Nov 12, 2016
@casey
Copy link
Owner Author

casey commented Nov 12, 2016

💛💚💙💜❤

@casey casey deleted the colors-and-wide-characters branch November 12, 2016 01:32
@casey casey mentioned this pull request Nov 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant