I can't seem to get rid of previously printed lines. If I do just
AnsiConsole.out.println(ansi);
It repeats the same output every successive output. E.g. A AB ABC
Even if the output is only supposed to be
A B C
My code is:
AnsiConsole.out.println(a);
a.eraseLine(Erase.ALL);
AnsiConsole.out.flush;
If I don't use a.eraseLine(Erase.ALL), it looks like this:
Also, if I don't use Jansi and use plain System.out, it looks like this so I know it's not a matter of code elsewhere.
Solution: Thanks to Betlista's answer. I found out what was wrong. The thing was that my ansi variable was actually called using the Ansi constructor and not the Ansi.ansi() method. That was what was different in my code. Thanks. :)
It seems you are doing something wrong, but there is a lot of info missing in your post, that it is hard to follow...
...so I'll write how it works for me:
I'm using maven with jansi in version 1.11 tested on Windows 7.
I simply followed the info on https://github.com/fusesource/jansi and my code
is doing exactly what I expected and this is the result: