Code Monkey home page Code Monkey logo

Comments (23)

mihnita avatar mihnita commented on June 15, 2024

Can you please try to click on the enable-disable icon at the top-right of the console?
It might be this: #45

And if you had 1.4.0.202001252332 installed before, that might have messed-up things a bit (it was always staring disabled).
That was #44
It's fixed, but might have left the plugin disabled.

Sorry,
Mihai

from ansi-econsole.

intractabilis avatar intractabilis commented on June 15, 2024

Clicking the icon didn't help. Btw, it has strange behavior. It needs two clicks to change the state. Not double click, just two ordinary clicks to change the state to the reverse and two other clicks to return back. I tried to build the project after each of the four clicks, still no colors, only escape codes.

from ansi-econsole.

mihnita avatar mihnita commented on June 15, 2024

The "two-click" is what I would expect.
It was disabled, but the icon was on.
First click would enable it, icon on (now they are in sync)

If you got to for clicks and you still see escapes then I suspect something else.

I don't expect to see �, that is not an escape. I suspected some copy-paste glitch...
That is the U+FFFD, the Unicode replacement character, you get it for bad encoding conversion.
So I suspect that is not a copy-paste problem, but the program really outputs something other than an escape character (a real U+FFFD)

What programming language are you using?
And how do you specify the escape in the string?
Does it work outside Eclipse, in a "normal console"?

In Java you should do something like this:
System.out.println("This is \033[0;1;32m green bold \033[m text.");
"...\u001b[32m green \u001b[m..." would also work.
I would not use the "raw" escape character (�), it's too easy to damage it (between various editors, version control systems, OSes, etc)

====

Ahh... I've pasted a "real escape" and GitHub shows it as the "diamond with question mark" (FFFD), unless I enter edit mode, and than it shows "properly" (so it is not really damaged, only rendered badly)

from ansi-econsole.

mihnita avatar mihnita commented on June 15, 2024

Another idea: make sure that in preferences the checkbox for "Show escape sequences" is not on.

from ansi-econsole.

intractabilis avatar intractabilis commented on June 15, 2024

It was disabled, but the icon was on.
First click would enable it, icon on (now they are in sync)

Why after they are in sync I still need two clicks to reverse the state?

I use Eclipse CDT and this an output from a C++ compiler. It is really 0x1b, it's just a copy&paste problem, the console shows a small square with 1b inside in the place of the escape character.

The thing is Ansi Console used to work before. And the color output of the compiler shows colors in a regular console. So I am pretty sure it's not a problem of wrong escape characters.

"Show escape sequences" is not on.

from ansi-econsole.

mihnita avatar mihnita commented on June 15, 2024

Sorry, but I am completely puzzled.

Why after they are in sync I still need two clicks to reverse the state?

It should not be needed, not inside the same session.
When restarting Eclipse with the plugin activated should again not be needed.
But it's needed (once) every time you exit Eclipse with it disabled.

This is apparently a long time bug (years), but I never noticed it until recently, because I never disable it. Files issue #45

Basically Eclipse adds the icon in the toolbar without even loading the plugin, at all.
The plugin is only loaded when first used.
So Eclipse should be able to figure out what icon to use depending on some plugin specific setting and without invoking the plugin.
Looks like there is a way to do it, but I have to migrate to a different even model (using commands). And even then it is not clear how (I already have a couple of branches where I'm trying that)
I'll do it, but will take a bit.
Anyway... this is an old bug (if it is the same thing)

But there is no reason that I can imagine to see the escapes...
I did nothing to change that.
For a little bit I had this bug with the plugin starting disabled always, no matter what the status was at exit. But not in 1.4.0.202001252332.
It was caused by my attempt to cache the settings a bit too aggressively.
I was checking the enable status for every line of output. And I think that was hitting the disk (maybe, I don't know what Eclipse does). But changing that made things measurably faster.

The thing is Ansi Console used to work before.

I hear you.
And I am also annoyed that I can't figure it out, sorry.
Problem is, I don't know how to reproduce it.

I've tested it on Windows, MacOS, 2 Linux distros, from Eclipse 2019_12 all the way to Neon (2016). Older than Neon don't work anymore because I've (finally) moved to JDK 8. But not for other technical reasons.

Tonight I will try again. And maybe push a new release, to see if that changes anything.
I have a small performance tweak, and I would like to sign the jar. There are no changes in the enable/disable area, but I hope that there is something cached somewhere and an update would change things.

I don't know, Eclipse does weird stuff... I was trying to play with signed jars and Eclipse ignored any of my changes. I even deleted the local folder from where I was installing, and Eclipse was still able to install "from that local folder" (which is of course impossible).

Just a crazy though (more like "I don't know what I'm doing, but let's try this" :-)
Stop eclipse and rename the .metadata/.plugins/org.eclipse.core.runtime/.settings/net.mihai-nita.ansicon.plugin.prefs file in your workspace.

Thanks,
Mihai

from ansi-econsole.

intractabilis avatar intractabilis commented on June 15, 2024

It should not be needed, not inside the same session.

It's not the behavior I observe. I can sit and click for hours in a cycle. It needs two clicks to reverse the state every time.

It's weird, I tested on two different Ubuntus. I see escapes in both.

Do you have any logs I can provide?

from ansi-econsole.

intractabilis avatar intractabilis commented on June 15, 2024

Stop eclipse and rename the .metadata/.plugins/org.eclipse.core.runtime/.settings/net.mihai-nita.ansicon.plugin.prefs file in your workspace.

I don't have such a file anywhere in .metadata.

from ansi-econsole.

intractabilis avatar intractabilis commented on June 15, 2024

I found .prefs file in some workspace that is a couple of months old. I copied it to the current .metadata. I see it changes as I change the settings, but still there are no colors.

from ansi-econsole.

mihnita avatar mihnita commented on June 15, 2024

I've played (the last few days) with Eclipse plugins.
And there is a lot of caching happening... and I don't know how to clean it
I've even been able to install a plugin "from a local folder" even after the folder was deleted, which is kind of crazy... :-)

Anyway. I have a couple of ideas:

  1. Try creating a new workspace and write a small hello world app there, see if it works.
    That would tell us if it is some problem in the combination of Eclipse + plugin, or something "dirty" in the workspace. If it is the second, there is a change that we can find out what that is and fix it.

  2. Try installing the latest "candidate" from https://mihai-nita.net/eclipse1/
    I've posted there a candidate for version 1.4.1
    It does not touch the code dealing with enable / disable, but my hope is that it will "nudge" whatever is stuck there.

from ansi-econsole.

mihnita avatar mihnita commented on June 15, 2024

BTW, I've also downloaded the 2019-12 CDT version of Eclipse, on Debian, installed my plugin from Marketplace, and works.

The only thing is the know issue with exiting Eclipse with the plugin disabled and the icon enabled.
Then it starts still disabled (good) with the icon enabled (bad).
One click on the icon "brings things in sync"
After one click the plugin is enabled (from disabled, good), and the icon stays enabled (good)

So I really have no idea what is happening on your machine :-(

from ansi-econsole.

intractabilis avatar intractabilis commented on June 15, 2024

Try creating a new workspace and write a small hello world app there, see if it works.
That would tell us if it is some problem in the combination of Eclipse + plugin, or something "dirty" in the workspace. If it is the second, there is a change that we can find out what that is and fix it.

Creating new workspaces doesn't help.

So I really have no idea what is happening on your machine :-(

I tried on two machines. Same behavior. No colors and the icon inverse the state on two clicks in a cycle.

Maybe the reason is in the JRE version?

from ansi-econsole.

mihnita avatar mihnita commented on June 15, 2024

That would be weird, but who knows, maybe not impossible.

I tried 8 (Oracle) and 11 (OpenJDK)

from ansi-econsole.

intractabilis avatar intractabilis commented on June 15, 2024

I tried 11 and 13 of OpenJDK, no difference.

Could it be your plugin works now only with stdout console, but not with CDT Build Console?

from ansi-econsole.

mihnita avatar mihnita commented on June 15, 2024

Did you have a chance to try 1.4.1?
And can you please paste a piece of string here, as it shows in you C++ code?
Also, is it printf, or streams ? stdout or stderr
(I have to admit I am "fishing", I am not sure what to look for)

Mihai

from ansi-econsole.

mihnita avatar mihnita commented on June 15, 2024

Could it be your plugin works now only with stdout console, but not with CDT Build Console?

There are ansi escape sequences in the build console?
I've tested everything with stdout and stderr, in the runtime console.
I don't think I've ever checked the build console. I'm not even sure that it is the same console (meaning the same Eclipse class implementing it)

How do you get escapes in the compiler output?
Errors in strings with escapes?

from ansi-econsole.

intractabilis avatar intractabilis commented on June 15, 2024

How do you get escapes in the compiler output?

GCC and Clang have a nice feature to print out diagnostic messages in colors when they compile. It's irrelevant to what I have in my C++ code as long as it compiles with warnings or errors. That's why I asked maybe your plugin doesn't work with the CDT Build Console anymore?

I'm not even sure that it is the same console (meaning the same Eclipse class implementing it)

The thing is, it worked before somehow.

from ansi-econsole.

intractabilis avatar intractabilis commented on June 15, 2024

Ok, now it's more clear. I confirm that there are colors in the program output console, but there are no colors in the CDT Build Console.

from ansi-econsole.

mihnita avatar mihnita commented on June 15, 2024

Got it! I can reproduce it!
That's was the mess, I didn't think to look at the build console.

Anyway, a problem reproduced is half solved (or something like that :-)
I'll get to it right now.

====

The root cause, and why it worked before (feel free to ignore :-)

The cause is the in the older version (< 1.4.0) I was registering a callback that was invoked by Eclipse once per line, to get the style (something like "hey, this is line 1231, with this text, give me a bunch of ranges with styles")
But with that I had no context, and the line numbers keep changing when the output goes beyond the buffer limit.

On top of that Eclipse would optimize things and didn't call me for very fast output.
I mean, what's the point to format line 300 if the output has 2000 lines and the console can only fit 100 lines. So if you changed the color in line 300 my code was never invoked.

The result of this was pretty bad handling of multiline output with formatting across lines.
But it worked for most types of consoles.

The 1.4.x big refactoring also intercepted changes in the document associated with the console (think something like a model-view-controler patters, with the doc being the model).
And on those document change events I find the escapes, add Positions to the doc, and those preserved the offsets, so I could keep track of context.
So now the formatting part (per line) goes to the doc, gets all the positions in the line, and can calculate the style ranges.

It looks like getting document associated with the console is not that portable though.
So I don't find the document for the build console, meaning I don't create positions in the doc.
And no positions, no formatting.

Just a bit of patience now :-)

Thanks a lot,
Mihai

from ansi-econsole.

mihnita avatar mihnita commented on June 15, 2024

How do you enable that diagnostic stuff?
To reproduce the bug I just used an escape sequence in a sting, and left it un-closed.
So the string itself, with escapes, is visible in the error message.
But I think it might be nice to check on something more realistic.
I didn't do enough C++ in Eclipse.

Thanks,
M.

from ansi-econsole.

intractabilis avatar intractabilis commented on June 15, 2024

How do you enable that diagnostic stuff?

There is nothing to be done to enable diagnostic. To enable colors in diagnostic you add -fdiagnostics-color=always to the compiler options. By default the value is auto, which produces colors in regular command line, but not in the redirected output. However, I like to see colors in the diagnostic messages in Eclipse too. This was the only reason I installed this plugin.

from ansi-econsole.

mihnita avatar mihnita commented on June 15, 2024

Should be fixed :-)
Bumped version to 1.4.1 for better clarity.

If you don't see it you might try forcing Eclipse to check (it does not do it by default)

Help == Install New Software... == Manage (top-right button)
Select "Mihai's Eclipse plugins" and click "Reload"
(make sure to not uncheck it when selecting it, it happened to me)

If all is good please let me know and I will close the bug (or you can close it, no problem)

Regards,
Mihai

from ansi-econsole.

intractabilis avatar intractabilis commented on June 15, 2024

Yay! It works! Thank you!

from ansi-econsole.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.