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.11k stars 140 forks source link

Merge JANSI into JLine #277

Open gnodet opened 11 months ago

gnodet commented 11 months ago

I'm really considering merging Jansi into JLine to ease the maintenance of both projects.

Proposed PR in https://github.com/jline/jline3/pull/871

xtaixe commented 11 months ago

As mentioned in the 2.4.1 release notes, dropping a note here because we are using the following:

var sz = new CLibrary.WinSize();
CLibrary.ioctl(fd, CLibrary.TIOCGWINSZ, sz);

var tty = CLibrary.ttyname(fd);

It would be great if there is an official way to get the tty name, width and height. We need those to do some fancy output stuff (line breaking, spinners, scrolling) and to check if stdin, stdout and stderr are the same terminal or not to avoid some of our fancy things going haywire.

Thanks.

gnodet commented 11 months ago

As mentioned in the 2.4.1 release notes, dropping a note here because we are using the following:

var sz = new CLibrary.WinSize();
CLibrary.ioctl(fd, CLibrary.TIOCGWINSZ, sz);

var tty = CLibrary.ttyname(fd);

It would be great if there is an official way to get the tty name, width and height. We need those to do some fancy output stuff (line breaking, spinners, scrolling) and to check if stdin, stdout and stderr are the same terminal or not to avoid some of our fancy things going haywire.

Thanks.

Agreed. This has already been partially addressed with https://github.com/jline/jline3/blob/master/terminal/src/main/java/org/jline/terminal/spi/TerminalProvider.java. What's missing is the ability to access the TerminalProvider without creating a terminal.