Author Topic: garbage characters on build window  (Read 8973 times)

itzhaki6

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
garbage characters on build window
« on: July 15, 2019, 02:08:03 PM »
Hi,
I'm using Mac OS, and I'm using Xcode as external build tool.
Build command: xcodebuild -target <target_name>
I'm getting weird characters on my build window, when I have compilation errors. For example:
"
<ESC>[1modules/calib.c:659:1:
<ESC> <ESC>error: <ESC><ESC>use of undeclared identifier 'sdf' <ESC>
sdf
<ESC>[0;1;32m^
<ESC>[0m
1 error generated.
"

When I'm running the same build command from external terminal, everything is ok:
"
modules/calib.c:659:1:
 error: use of undeclared identifier 'sdf'
sdf

^

1 error generated.
"

Any ideas?
Thanks
« Last Edit: July 15, 2019, 02:11:40 PM by itzhaki6 »

Russ

  • Community Member
  • Posts: 56
  • Hero Points: 3
Re: garbage characters on build window
« Reply #1 on: July 15, 2019, 05:01:19 PM »
They look like ANSI escape sequences
http://ascii-table.com/ansi-escape-sequences-vt-100.php

So <ESC>[1m means turn bold on and <ESC>[0m means turn attribute off

I guess what's happening is your external terminal is interpreting the escape sequences

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: garbage characters on build window
« Reply #2 on: July 15, 2019, 11:53:09 PM »
Its an ongoing feature request for SE to handle these escape sequences:

https://community.slickedit.com/index.php/topic,15761.0.html

itzhaki6

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: garbage characters on build window
« Reply #3 on: July 16, 2019, 08:13:15 AM »
Thank you guys for your replies.
Is there anyway to work around it? Maybe running the shell differently from the slick edit?

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: garbage characters on build window
« Reply #4 on: July 16, 2019, 11:56:10 AM »
According to: https://no-color.org/

If you can add a flag to the clang compilation line in your xcode project: -fno-color-diagnostics

In my GCC projects I use "export GCC_COLORS=", but according to "no-color.org" that is not available for clang.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: garbage characters on build window
« Reply #5 on: July 16, 2019, 11:59:52 AM »
According to no-color.org, there is a question:

"Why not just set $TERM to dumb or xterm without color support? "

Before launch SE I do "export TERM=". Its been so long since I added that to my SE launching script that I forgot why.

You can try setting or unsetting TERM as I described, let us know what works/doesn't work.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: garbage characters on build window
« Reply #6 on: July 16, 2019, 12:08:53 PM »
You could also try piping the output (and stderr, using  to "tee" - "xcodebuild -target <target_name> 2>&1 | tee logfile"), then you can get a logfile as a bonus (another feature I've requested from SE is to log build output). I've seen some places online that say if the compiler output is not to a terminal then the color output will be disabled. Let us know if this works.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: garbage characters on build window
« Reply #7 on: July 16, 2019, 12:13:41 PM »
Also found a tool "xcpretty" that may be an option: https://github.com/xcpretty/xcpretty

Do google searches of "xcodebuild no color", etc, that is how I found this.

itzhaki6

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: garbage characters on build window
« Reply #8 on: July 17, 2019, 04:26:50 PM »
Hi,
Adding the -fno-color-diagnostics to the make file solved this issue for me.
Regarding the log output addition, it didn't make a difference.
Thanks a lot for the support!

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: garbage characters on build window
« Reply #9 on: July 31, 2019, 12:13:23 PM »
v24 supports escape colors in the Build window. The beta is available now.  For example, "g++ -fdiagnostics-color=always myfile.cpp" or "clang++ -fdiagnostics-color=always myfile.cpp" will display colored error messages in the Build window. Cursor movement and non-color escape sequences are not supported. For Unix and macOS, using SoftWrap in the Build Window disables support for bold, italics, and underline. This is a limitation of SoftWrap in Unicode text.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: garbage characters on build window
« Reply #10 on: August 01, 2019, 02:40:20 PM »
Thanks so much! Very excited to try this out!

Have not tried the beta yet, just back from vacation. For cursor movement and non-color escape sequences does v24 suppress the escape characters? I think it would be useful for SE to suppress the escape characters. For my bash prompt, I use an escape sequence for the title of the window - would also be nice to have v24 suppress the title that I put into the window, instead of seeing the title and actual prompt in my prompt. I will give a more detailed example later.

Also, what about if one opens a logfile that has color coding escape characters in it? Will that be displayed properly?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: garbage characters on build window
« Reply #11 on: August 01, 2019, 04:09:25 PM »
For cursor movement and non-color escapes SlickEdit tries to remove them.

As for opening a log file with color, that isn’t practical yet because SlickEdit would have modify the file to apply the color. Then when you save the file the escape data would be gone.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: garbage characters on build window
« Reply #12 on: August 01, 2019, 04:17:59 PM »
For log files with color, I usually don't want to save them (just want to view/search them) so having this limitation would be fine with me. If it could be automatically detected that escape codes are there or if I could use some menu option that would be nice, and perhaps a warning if user tries to save it.