fusesource / jansi

Jansi is a small java library that allows you to use ANSI escape sequences to format your console output which works even on windows.
http://fusesource.github.io/jansi/
Apache License 2.0
1.1k stars 139 forks source link

Netbeans support #87

Open cowwoc opened 7 years ago

cowwoc commented 7 years ago

On last check, the Netbeans terminal supports XTERM 16-bit colors.

When running jansi under Windows, it mistakenly assumes that the terminal does not support any colors and strips them out.

Now that Maven 3.5.0 has integrated jansi into core, it is breaking color support under Netbeans: https://netbeans.org/bugzilla/show_bug.cgi?id=270593

Please consider adding Netbeans-detection code, so colors can be used.

cowwoc commented 7 years ago

Sorry, I meant Netbeans supports 16 colors, not 16-bit colors. I believe they only support the basic 8 color palette in "normal" or "bright" mode.

gnodet commented 6 years ago

Sure. Any idea how to detect Netbeans ?

cowwoc commented 6 years ago

Good question. I don't think there is a way, so I guess we are forced to set extra system properties that will tell JANSI to assume the use of 16 colors. I assume this is possible?

gnodet commented 6 years ago

It already exists: -Djansi.passthrough=true should let ansi sequences through.

cowwoc commented 6 years ago

But don't you have to specify what ANSI mode is supported? Some terminals support 8 colors, others 16 colors, others 256 colors and others 16 million colors. If I enabled passthrough, which mode will get used?

peterremote1980 commented 6 years ago

-Djansi.passthrough=true is not working in Netbeans 8.2 with maven 3.5.3, just tried

hboutemy commented 6 years ago

just tried with Netbeans 8.2 and 9.0 beta on Linux: running "java -jar jansi-1.17.1.jar" in Netbeans terminal (Window > IDE Tools > Terminal) perfectly displays colors "mvn -v" also displays colors

which version of Netbeans on which OS does not display colors?

rkraneis commented 5 years ago

@peterremote1980, adding -Djansi.passthrough=true to MAVEN_OPTS actually does work (at least on CentOS 7), but breaks general Maven output handling. Now text like [INFO] NETBEANS-ExecEvent:{"type":"ForkSucceeded"} appears in the output, collapsing of folds does not work any more and the build can not be resumed from the last failure. But that looks more like NetBeans problems TBH ...

peterremote1980 commented 5 years ago

@rkraneis i added this to .bashrc, but not working :-) Thanks anyway

export MAVEN_OPTS='-Xmx1024m -Xms128m -Xss10m -Djansi.passthrough=true'

peterremote1980 commented 5 years ago

This works only in mac terminal, but NOT in netbeans output window:

System.setProperty("jansi.passthrough", "true");

rkraneis commented 3 years ago

Stumbled across this again and also about a way to remove NETBEANS-ExecEvent: from the output:

MAVEN_OPTS=-Djansi.passthrough=true -Dorg.slf4j.simpleLogger.log.org.netbeans.modules.maven.event=off

You can set these in the project properties or as a Custom Global Maven Goal Definition to not disturb anything else (and I'm not sure if .bashrc is evaluated at all on Mac for applications that are not started from a shell; on Linux/Gnome it is, which is how I can set MAVEN_OPTS globally, but don't, for reasons given below).

image

And this is the output (colorful as expected)

image

But, as already said, all NetBeans-added features then cease to work (collapsing of folds or discovery of run tests). I would only use this for the Build actions; definitely not for Test.

And long story short: I'm not sure how much of that can be fixed or worked around in jansi library.