Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could this be generalized to work on mac/linux? #113

Open
lihaoyi opened this issue Jan 1, 2025 · 1 comment
Open

Could this be generalized to work on mac/linux? #113

lihaoyi opened this issue Jan 1, 2025 · 1 comment

Comments

@lihaoyi
Copy link

lihaoyi commented Jan 1, 2025

Mill currently uses windows-ansi on windows, but shells out to tput on mac and linux because it is faster than classloading the whole of jline/jansi to access the terminal dimensions (which takes a few hundred ms). I wonder if accessing the native APIs directly on mac/linux would be faster than using jline or shelling out to tput, and it would be a nice generalization of this project

@alexarchambault
Copy link
Owner

That could work.

Just one note: up to now, I haven't felt much the need to do native calls to query the terminal size, as the tput output can be cached, and needs to be refreshed only when we receive a SIGWINCH (like done here). But catching signals (via sun.misc.Signal*) is now an unsupported API on the JVM apparently (and it seems some JVMs just don't support it).

So it might good to offer a native way to either:

  • query the terminal size natively as you suggest (via the ioctl call that jline does)
  • know when we received a SIGWINCH

But both ways could be supported too. That way, users wouldn't have to shell out to tput at all, and could use the SIGWINCH stuff at their option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants