fstiewitz / build-tools-cpp

Build your projects in atom
https://atom.io/packages/build-tools
MIT License
31 stars 6 forks source link

Using "Remove ANSI Color Codes" or "Parse ANSI Color Codes" removes all console lines #54

Closed mertzt89 closed 8 years ago

mertzt89 commented 8 years ago

When using "Remove ANSI Color Codes" or "Parse ANSI Color Codes" options it causes the console output to be blank instead of just removing/parsing the ANSI formatting.

OS: Windows 7 atom: 1.3.2 build-tools: 4.3.2

mertzt89 commented 8 years ago

I didn't see #49 which may be addressing this

fstiewitz commented 8 years ago

49 is an enhancement, not a bug fix.

Do you use pty.js and/or execute in shell for your command ? Also: Does Windows even support ANSI Codes ? Sorry, but I have most of my windows knowledge from Wikipedia

mertzt89 commented 8 years ago

I use both pty.js and "execute in shell" with command "apm show build-tools"

Console output with set to "Ignore ANSI Color Codes":

wintest of C:\Users\mertz\github\build-tools
[?25l

[?25h[?25l
build-tools
├── 4.3.2
├── https://github.com/deprint/build-tools-cpp
├── Build your projects in atom
├── 14747 downloads
└── 16 stars

Run `apm install build-tools` to install this package.


[?25h

With set to "Remove ANSI Color Codes": In lib/pipeline/output-stream.coffee i added some prints

        data = data.substr(0, m.index)
      return data

    in: (data) ->
      console.log 'before: ', data
      data = @removeAnsi data if @stream.highlighting isnt 'nh' or @stream.ansi_option is 'remove'
      console.log 'after: ', data
      return if data is ''
      @buffer += data

Result on output console: Blank

Output on debug console:

before:  [?25l

[?25h
after:  

before:  [?25l
build-tools
├── 4.3.2
├── https://github.com/deprint/build-tools-cpp
├── Build your projects in atom
├── 14747 downloads
└── 16 stars

Run `apm install build-tools` to install this package.


[?25h
after:  

I could probably spend more time to help you debug/fix this and continue to do windows testing. I more or less wanted to make sure that you intend for it to be functional at this stage.

fstiewitz commented 8 years ago

Actually I think I already found the problem (and it's not windows-specific, so I can fix it): The ANSI Specification is quite large (at least for a simple console like mine). The package only implements the most common color codes, which are more than sufficient for building projects, and ignores all other codes. ... at least, that's what it should do. Right now, it does not detect when a non-color code ends, so it assumes that the entire output is one large escape code and removeAnsi then does what it is supposed to do and removes it. I should be able to fix it in the next couple of days :bow:

fstiewitz commented 8 years ago

Fixed in v4.3.3. Remove ANSI removes all ANSI Codes. Parse ANSI only removes and highlights color codes, which means that, in your example, \x1b[0K and others will remain visible.