Bug 112948 - [console] Make the console ANSI compliant
Summary: [console] Make the console ANSI compliant
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement with 9 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
: 184379 314004 438914 516406 (view as bug list)
Depends on:
Blocks: 544307
  Show dependency tree
 
Reported: 2005-10-18 11:19 EDT by Oliver Henning CLA
Modified: 2022-06-30 04:21 EDT (History)
29 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Henning CLA 2005-10-18 11:19:36 EDT
The console-View within Eclipse is a 'dump' one which handles 3 Streams: out,err,in.

It would be an interesting feature when this console would interpret
ANSI-Escape-Sequences (at least the following):
- Clear-Screen
- Cursor movements and placements
- Set Background-Color/Text-Color
- Set/Reset Bold/Italic font

Reason: To write Text-Console oriented Applications (normally in C, but why not
in Java) which should later run in a Unix/Linux-Console this should work.

Thank you for the effort.

Oliver Henning
Comment 1 Darin Wright CLA 2005-10-25 17:25:21 EDT
Not planned for 3.2. Contributions welcome. If someone is willing to write 
this console, please contact us so we can agree on an initial design .
Comment 2 Morten Moeller CLA 2006-01-29 14:35:19 EST
+1 This would be a great enhancement.
Comment 3 Tor Arne Vestbø CLA 2006-03-23 06:29:33 EST
+1 Very usefull!
Comment 4 Joachim Lusiardi CLA 2006-04-11 07:31:39 EDT
+1 i would also like to have this feature ;-)
Comment 5 barrach CLA 2006-05-09 14:06:40 EDT
+1 This feature would make eclipse much more attractive to us.  We're searching for an IDE for our new hardware test system, but it must have an ANSI compliant terminal.  
Comment 6 Darin Wright CLA 2007-04-27 17:28:15 EDT
*** Bug 184379 has been marked as a duplicate of this bug. ***
Comment 7 Denis Roy CLA 2009-08-30 02:21:31 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.
Comment 8 Anton Leherbauer CLA 2010-05-20 04:17:31 EDT
FYI, there exists an ANSI terminal emulation widget as part of the Target Management project.  It just needs to be integrated into an IConsole implementation.  See also bug 242373.
Comment 9 Pawel Piech CLA 2010-05-24 11:22:19 EDT
*** Bug 314004 has been marked as a duplicate of this bug. ***
Comment 10 Hendy Irawan CLA 2011-07-13 12:36:54 EDT
+1 for this!
Comment 11 Sorin Sbarnea CLA 2011-12-05 06:04:45 EST
Why is this bug marked as Resolved/WONTFIX when there is no comment explaining this? Looking at the comments I would expect to see it as open.
Comment 12 Curtis Windatt CLA 2011-12-05 09:07:02 EST
(In reply to comment #11)
> Why is this bug marked as Resolved/WONTFIX when there is no comment explaining
> this? Looking at the comments I would expect to see it as open.

(In reply to comment #7)
> As of now 'LATER' and 'REMIND' resolutions are no longer supported.
> Please reopen this bug if it is still valid for you.
Comment 13 Ted Shaneyfelt CLA 2012-08-25 18:39:34 EDT
(In reply to comment #7)
> As of now 'LATER' and 'REMIND' resolutions are no longer supported.
> Please reopen this bug if it is still valid for you.

How? Someone who knows how please reopen as suggested. There's currently no way for the UUT to clear the screen and repaint it. ANSI would do that and much more. 
Start with support for ESC[2J clear screen and then you can add ESC[r,cH cursor position control and other stuff as incremental improvements. 

Or if ANSI is too difficult, at least the pre-ADM3A basic ^H = LEFT.
Comment 14 Missing name CLA 2012-08-28 04:48:05 EDT
I also don’t know how to change the status of this bug report to “re-open” it again.

However I have some experience with implementing ANSI control codes in Java. I once adapted a JTextPane to display coloured text based on ANSI colour codes. I would be willing to help but I don’t have the eclipse code set up for development. Perhaps you could point me to a tutorial on how to get that working and I’ll give it a shot.
Comment 15 Martijn Dashorst CLA 2014-07-04 08:08:12 EDT
I opened a new feature request for this issue as I did not see any possibility of reopening this one. Find it here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=438914
Comment 16 David Williams CLA 2014-07-05 02:36:27 EDT
(In reply to Martijn Dashorst from comment #15)
> I opened a new feature request for this issue as I did not see any
> possibility of reopening this one. Find it here:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=438914

I appears I can re-open. And, appears the way to do so is by the "edit" button near top, right on the "status" line ... which seems new. If this works, I'll close bug 438914 as invalid. 

Disclaimer: by re-opening, I'm not judging the merits, or priority of the bug, and not changing the fact this will take a community contribution, etc.
Comment 17 Michael Rennie CLA 2014-07-07 09:42:09 EDT
*** Bug 438914 has been marked as a duplicate of this bug. ***
Comment 18 Michael Rennie CLA 2014-07-07 09:47:09 EDT
(In reply to Michael Rennie from comment #17)
> *** Bug 438914 has been marked as a duplicate of this bug. ***

Anyone interested is trying to implement this should first have a look at the wiki: http://wiki.eclipse.org/Debug/Developers

It will help get you up and running with the source and the patch / fix expectations.
Comment 19 Alexander Wessel CLA 2016-04-28 11:30:09 EDT
For reference, I have solved my ANSI coloring needs by using the Ansi Console plugin by Mihai Nita.

http://mihai-nita.net/2013/06/03/eclipse-plugin-ansi-in-console/
https://marketplace.eclipse.org/content/ansi-escape-console

There is no support for anything other than line styling, but my logback output is nicely highlighted now. :)

It would still be a nice feature to have a fully compliant ANSI console, i. e. wrap the Target Management Terminal as an IConsole.
Comment 20 Simon Bernard CLA 2018-10-11 10:31:07 EDT
+1 !

I was very surprised when I saw that is not already supported by eclipse. I mean using color for text output begin to be usual. Even windows support it since windows 10 : https://en.wikipedia.org/wiki/ANSI_escape_code#Windows

Of course a good support of ANSI-escape-sequences should be ideal, but this should be done step by step, I propose :

1.The minimal step should be to ignore characters to avoid this kind of crappy output you could face using common library like logback with color enabled.

<code>
[main] [34mINFO [0;39m [36mo.e.l.s.d.Server[0;39m - Web server started at http://0.0.0.0:8080/. 
</code>

2. Supporting color, bold/italic should cover most part of the needs.

3. Clear-Screen / Cursor movements and placements is maybe a less common use case.

I see there is a lot of external plugin which support it (like grep console or ansi-econsole)
- https://stackoverflow.com/questions/233790/colorize-logs-in-eclipse-console
- https://mihai-nita.net/2013/06/03/eclipse-plugin-ansi-in-console/

There was also an ANSI terminal emulation widget as part of the Target Management project (I don't know if it is still maintained)

So my question why a feature which seems already implemented and requested by community since almost 15 years is not already integrated by default in a great IDE like eclipse ?

Is there blocking technical issue ?
Comment 21 Sarika Sinha CLA 2018-10-11 23:24:33 EDT
We don't have any resource to work on this, If someone can provide a quality patch, we can look into it.
Comment 22 Mihai Nita CLA 2018-10-20 18:23:06 EDT
Hi,

I am the author of the "ANSI Escape in Console" plugin
 - https://marketplace.eclipse.org/content/ansi-escape-console
 - https://mihai-nita.net/2013/06/03/eclipse-plugin-ansi-in-console/
 - https://github.com/mihnita/ansi-econsole

I am thinking about contributing the functionality to the official Eclipse Console.

I understand that you have no resources to work on this.
But is anyone who is familiar enough with that code / or the Eclipse "philosophy"?
To answer some occasional questions, give some early warnings?
Probably most of it not programming, but behavior.

This might be "a bit intrusive".

For instance what should happen if the official console interprets the ANSI escapes and applies styles, but some other plugin registers a LineStyleListener.
Who should "win"?
And who should "win" between colors from ANSI escapes and the stderr color?
Is it enough if this will only handle ANSI escapes for colors, so no clear console, cursor positioning, etc?

Basically someone to say "yes, good direction" before I spend days writing code :-)

Thanks you,
Mihai
Comment 23 Sarika Sinha CLA 2018-10-23 04:02:07 EDT
(In reply to Mihai Nita from comment #22)
> Hi,
> 
> I am the author of the "ANSI Escape in Console" plugin
>  - https://marketplace.eclipse.org/content/ansi-escape-console
>  - https://mihai-nita.net/2013/06/03/eclipse-plugin-ansi-in-console/
>  - https://github.com/mihnita/ansi-econsole
> 
> I am thinking about contributing the functionality to the official Eclipse
> Console.
> 
> I understand that you have no resources to work on this.
> But is anyone who is familiar enough with that code / or the Eclipse
> "philosophy"?
> To answer some occasional questions, give some early warnings?
> Probably most of it not programming, but behavior.
> 
> This might be "a bit intrusive".
> 
> For instance what should happen if the official console interprets the ANSI
> escapes and applies styles, but some other plugin registers a
> LineStyleListener.
> Who should "win"?
> And who should "win" between colors from ANSI escapes and the stderr color?
> Is it enough if this will only handle ANSI escapes for colors, so no clear
> console, cursor positioning, etc?
> 
> Basically someone to say "yes, good direction" before I spend days writing
> code :-)
> 
> Thanks you,
> Mihai

Yes, We should be able to guide the direction and answer the questions.
Comment 24 Mickael Istria CLA 2019-11-20 08:47:00 EST
(In reply to Mihai Nita from comment #22)
> For instance what should happen if the official console interprets the ANSI
> escapes and applies styles, but some other plugin registers a
> LineStyleListener.
> Who should "win"?

Because backwards compatibility matters a lot, I think that the LineStyleListener should win (ie override the ANSI colors), so ANSI support wouldn't break existing applications relying on LineStyleListener.
Once example is for links (URLs, location in a .java file...), the console shows them with the typical link style using a LineStyleListener (I believe); the decision to show a link here is always more important than some potential style used in the application output for that.

> And who should "win" between colors from ANSI escapes and the stderr color?

I think default stderr color must remain red.
Also, I imagine that the amount of cases where people do ANSI in stderr is very low, so we could simply just ANSI-fy the stderr at the moment.

> Is it enough if this will only handle ANSI escapes for colors, so no clear
> console, cursor positioning, etc?

That would be already great IMO, we don't need to target full ANSI compliance at once, we can do it step by step.
Comment 25 Hannes Wellmann CLA 2022-01-30 11:56:09 EST
*** Bug 516406 has been marked as a duplicate of this bug. ***
Comment 26 Hannes Wellmann CLA 2022-01-30 12:05:35 EST
(In reply to Mihai Nita from comment #22)
> Hi,
> 
> I am thinking about contributing the functionality to the official Eclipse
> Console.
> 

Do you still plan to work on this?
It looks like many people would appreciate it (including myself). If the ANSI console would be integrated into Eclipse it could possible to achieve a tighter integration and it would allow other Eclipse projects to relay on it too (for example the Eclipse Maven integration m2e).
Comment 27 Yannick DAVELUY CLA 2022-06-20 16:35:28 EDT
Hi,
I would be interested to contribute to this functionality.

I developed a preliminary version available in https://github.com/ydaveluy/eclipse.platform.debug/tree/feature/ansi_console


If you are interested I can improve the code and create a pull request.

Yannick Daveluy
Comment 28 Mickael Istria CLA 2022-06-20 16:50:11 EDT
(In reply to Yannick DAVELUY from comment #27)
> If you are interested I can improve the code and create a pull request.

We're definitely interested! Do you think you could submit this as one or more PRs against the eclipse.platform.debug GitHub repo?
Comment 29 Hannes Wellmann CLA 2022-06-20 17:10:07 EDT
Yes, we are interested.

But I want to mention that Mihai Nita, the author of the "Eclipse ANSI Console" plugin plug-in already started some effort towards contributing the Eclipse ANSI Console to the Eclipse-Platform:
https://github.com/mihnita/ansi-econsole/issues/70

In order to avoid duplicated work I suggest you two talk to each other and coordinate your work.
Comment 30 Yannick DAVELUY CLA 2022-06-20 17:27:24 EDT
My works is inspired from the Eclipse ANSI Console.

Here is the PR: https://github.com/eclipse-platform/eclipse.platform.debug/pull/40
Comment 31 Mihai Nita CLA 2022-06-26 23:16:42 EDT
Sorry guys, I don't think this is cool.

Yannick, what are you doing?

I have been working on that plugin for 10 years, you forked it 3 weeks ago or so, and want to contribute it to Eclipse yourself?

This is (maybe) legal, my project being covered by Apache 2 and EPL 2.

But:
 - if you though to help, you should have asked
 - I have already stared doing this myself. That is why added EPL 2.

For the Eclipse guys: do you want to just have the code as is, or continue to work and get maintenance?
And if you would prefer maintenance, then would you rather have if done by the original author, who maintained and improved this for 10 years?
Or some random guy who forked it?

Also note that the IP is not yet 100% out of the woods.

See the end of https://github.com/mihnita/ansi-econsole/issues/70
"For now though I am working to get a clearance from my employer.
...
TLDR: I don't expect problems, except for some delay.
But I want to make sure I "dot all the i's and cross all the t's" from the legal side.
"

Thank you very much,
Mihai
Comment 32 Mihai Nita CLA 2022-06-30 04:21:08 EDT
Moving forward with the integration of the "ANSI Escapes in the Eclipse Console" plugin

The progress is tracked by https://github.com/eclipse-platform/eclipse.platform.debug/issues/47