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

Fix formatting and colors on Windows #1510

Merged
merged 1 commit into from
Feb 24, 2017
Merged

Fix formatting and colors on Windows #1510

merged 1 commit into from
Feb 24, 2017

Conversation

trickyearlobe
Copy link
Contributor

Fixes issue #1508

  • Windows terminals don't support extended ANSI colours. Use basic + intensity
  • Windows terminals don't support UTF-8 well so don't use special characters

Other OS'es get what they had before.

Signed-off-by: Richard Nixon richard.nixon@btinternet.com

Fixes issue #1508

* Windows terminals don't support extended ANSI colours. Use basic + intensity
* Windows terminals don't support UTF-8 well so don't use special characters

Other OS'es get what they had before.

Signed-off-by: Richard Nixon <richard.nixon@btinternet.com>
Copy link
Contributor

@chris-rock chris-rock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great finding @trickyearlobe Thank you for raising the issue and proposing a fix.

'small' => ' ',
}.freeze
case RUBY_PLATFORM
when /windows|mswin|msys|mingw|cygwin/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should find a solution that is not dependent on OS detection, since there are terminal available for windows that support UTF8 like http://cmder.net/
I am okay to merge it anyway since this is solving the problem for most Windows users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My customer prefers to use Powershell. CMDER does support UTF8 but the symbols don't render and it still has the extended colors problem. The symbols may just be down to selected font or codepage (have to execute chcp 65001 to get UTF8 on most machines)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW... I love CMDER... its my go-to terminal when I have to use Windows :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @trickyearlobe for the explanation.

Copy link
Contributor Author

@trickyearlobe trickyearlobe Feb 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing a bit more digging, it seems that for the UTF8 symbols to display, you need to switch to UTF8 with chcp 65001 and then change the terminal font to one that includes emojis (such as Segoe UI Symbol).

I also did a bit of digging around autodetection of terminal type or color support. ANSI does define some queries but most of the Windows terminals ignore them (despite the sequences being documented on MSDN)

See this link https://en.wikipedia.org/wiki/Emoji#Microsoft_Windows

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trickyearlobe Thank you for the deeper investigation. I agree with you that the os detection is a safe bet.

@arlimus arlimus self-requested a review February 24, 2017 15:25
Copy link
Contributor

@arlimus arlimus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, kudos for all the investigation and fixing it Richard!!

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

3 participants