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

Automatic re-render on terminal window resize #178

Open
deg0nz opened this issue Feb 22, 2022 · 1 comment
Open

Automatic re-render on terminal window resize #178

deg0nz opened this issue Feb 22, 2022 · 1 comment

Comments

@deg0nz
Copy link
Contributor

deg0nz commented Feb 22, 2022

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:

sigwinch-test

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...

@deg0nz
Copy link
Contributor Author

deg0nz commented May 29, 2022

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.

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

1 participant