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. :)