Open deg0nz opened 2 years ago
I digged into this a litte bit further some time ago. I came across an issue that needs multi-threading to make this work correctly and nicely.
The current state of console
and dialoguer
would need some work to make this possible.
Since @pksunkara mentioned, that dialoguer
shall be refactored to use crossterm
, I suggest this issue should wait until the transition to crossterm
is done.
crossterm
conveniently supports terminal resize events and also multi-threading. So after that, this feature can be integrated more easily.
I looked a little further into the issue we discussed in #130.
So far, I found a solution for *nix systems. The foreground process gets the
SIGWINCH
signal when a terminal is resized. I tried catching it as described here and it seems to work:We could just create another feature that hooks into the signal and then let the screen re-render itself.
This would add 1 additional dependency if we go the way where we spawn a dedicated thread that observes the signal as in the example above (
signal-hook
).Unfortunately, I don't really know how the Windows part would look like. After some quick research, maybe
ResizePseudoConsole
could be used for this ?! It would be nice if someone could help out here...