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

Stack produces wrong terminal color codes for file paths #4139

Closed
pakettiale opened this Issue Jul 7, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@pakettiale
Copy link

pakettiale commented Jul 7, 2018

General summary/comments (optional)

Given that in stack/scr/Stack/PrettyPrint.hs style for the files is

styleFile = bold . white . ondullblack

this should correspond to ANSI code ^[[1m^[[37m^[[40m however stack outputs ^[[1m^[[97m.

See this gist for ANSI codes.

Steps to reproduce

  1. Enable script to see raw output: script debug_stack_output.
  2. Run command stack ghci outside of any project.
  3. Stack outputs a note regarding missing project and some paths in the note may be printed in a color that's invisible (depands on your terminal color scheme).
  4. Type :q into ghci propt.
  5. Type control-d to stop script command.
  6. View debug_stack_output in an editor vim debug_stack_output.
  7. You should see a line
* If you want to start a different project configuration than ^[[1m^[[97m/home/username/.stack/global-project/stack.yaml^[[0;1m^[[0m,
  1. Despite the definition in stack/scr/Stack/PrettyPrint.hs
styleFile = bold . white . ondullblack

Expected

When running stack ghci outside of any project the note should have paths printed in bold white on a black backgroud.

Actual

The paths were printed on bold white on white backgroud.

Relevant Places in stack Source:

display stackYaml
instance Display (Path b File)
styleFile

Stack version

$ stack --version
Version 1.7.1, Git revision 681c800873816c022739ca7ed14755e85a579565 (5807 commits) x86_64 hpack-0.28.2

Method of installation

  • Official binary, downloaded from stackage.org or fpcomplete's package repository
@mihaimaruseac

This comment has been minimized.

Copy link
Contributor

mihaimaruseac commented Jul 8, 2018

Is this on Windows or any OS?

@pakettiale

This comment has been minimized.

Copy link
Author

pakettiale commented Jul 8, 2018

Happens on Linux, can't test on Windows.

@mpilgrem

This comment has been minimized.

Copy link
Contributor

mpilgrem commented Jul 26, 2018

I can't reproduce this (using Version 1.8.0, Git revision 861cf3229235ba22aa98b1fa8958e208a1cd10cf (dirty) (6002 commits) x86_64 hpack-0.28.2). I'm on Windows 10, but the underlying ansi-terminal package's code is the same for Windows 10 and Unix-like operating systems.

I have stack outputting \ESC[1m\ESC[97m\ESC40m before the filenames. (EDIT: This is true also in, say, a mintty terminal using Cygwyn.)

Note that white in styleFile = bold . white . ondullblack refers to 'vivid' white (\ESC[97m) and not to 'dull' white (\ESC[37m).

If the intent was indeed 'dull' white, the line should be:

styleFile = bold . dullwhite . ondullblack

@mpilgrem

This comment has been minimized.

Copy link
Contributor

mpilgrem commented Jul 27, 2018

I also can not reproduce this using version Version 1.8.0, Git revision 94d302c40d3d08dcaa0213f3f1ffdc1384842714 (6077 commits) x86_64 hpack-0.29.0 on macOS High Sierra 10.13.6 using the native Terminal.app console. Again, stack outputs the expected \ESC[1m\ESC[97m\ESC40m.

@mihaimaruseac

This comment has been minimized.

Copy link
Contributor

mihaimaruseac commented Jul 28, 2018

I was not able to reproduce either, neither on Linux nor on Mac. I think these are changed from between 1.7.1 and 1.8.0.

@pakettiale, can you please try with 1.8.0? Either upgrade to it via stack upgrade --git or wait a few days until the release of the new Stack version.

@pakettiale

This comment has been minimized.

Copy link
Author

pakettiale commented Jul 31, 2018

I can confirm that Version 1.8.0, Git revision 864c35e23a6f43129e28436b1daac8821be93117 x86_64 hpack-0.29.0 from git solves this issue for me.

@pakettiale pakettiale closed this Jul 31, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment