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

cursor methods are not working on 2.4.0 #248

Closed afattahi54 closed 9 months ago

afattahi54 commented 1 year ago

I am using version 2.4.0., with eclipse 202301310704

cursorDownLine and others cursor methods are not working

AnsiConsole.systemInstall();

Ansi ansi = Ansi.ansi().eraseScreen().restoreCursorPosition().saveCursorPosition();
ansi.fg(Color.BLUE)
    .a("hello")
    .newline()
    .a("world")
    .cursorDownLine(3)
    .a("!!!");
AnsiConsole.sysOut().println(ansi);
AnsiConsole.systemUninstall();

And output:

hello
world!!!

I find that none of Cursor and also erase line are not working too.

I work when I downgrade to 1.18 and it is working

gnodet commented 11 months ago

@afattahi54 could you paste the output of AnsiMain#main() method when run from the eclipse console please ?

gnodet commented 9 months ago

@afattahi54 you need to use AnsiConsole.out() and not AnsiConsole.sysOut(), the latter returns the original system stream, not the Jansi-enabled one.