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

Stack produces wrong terminal color codes for file paths #4139

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

Stack produces wrong terminal color codes for file paths #4139

pakettiale opened this issue Jul 7, 2018 · 6 comments

Comments

@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
Copy link
Contributor

Is this on Windows or any OS?

@pakettiale
Copy link
Author

Happens on Linux, can't test on Windows.

@mpilgrem
Copy link
Member

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
Copy link
Member

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
Copy link
Contributor

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
Copy link
Author

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

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

No branches or pull requests

3 participants