jline/jline3

Add support for monitoring window size changes.

Irineu333 opened this issue · 2 comments

I'm new to the world of command line programs, so I don't know how hard it is to implement this (or even if it's possible). But I would like there to be a way to monitor changes in screen size, to adjust the screen in real time, like ncdu, htop, and midnight commander do.

Jline can dispatch signals and it would be WINCH in this case. https://en.wikipedia.org/wiki/Signal_(IPC)#SIGWINCH

edit: like this example

Terminal.SignalHandler prevHandler = terminal.handle(Terminal.Signal.WINCH, this::handle);

Thank you @jvalkeal, that solved my problem!