-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add Terminal Reset Helper #203
Comments
What's kind of ironic here is that the actual terminal settings are usually already properly reset, what's not reset is the cursor which is not in the terminal state that is manipulated via normal operations. Instead the cursor is hidden and shown via ANSI codes and there is no reasonable way to query the state of that. So in a way what would need to be done is to carefully manage the cursor state within console/dialoguer independently. I'm really not sure what the most reasonable approach is here. |
This came out of the issue filed over at dialoguer: console-rs/dialoguer#294
The TLDR is that when the application terminates in unexpected ways (or really just ctrl+c) it's pretty easy for the terminal to be left in an unfortunate state. While there might be ways in which APIs can be restructured to cause this less, this is generally quite unfortunate and too easy to cause.
It also will in most cases require either using raw inputs to ensure that ctrl+c is manually handled on all inputs to reset the terminal state locally or (more correctly) to handle cltr+c globally. The latter however requires the user to be involved here as there can really only be one handler via the
ctrlc
crate or similar.As a strawman proposal I'm considering adding a helper that people can put into their own ctrlc handlers which resets the terminal back to the state it was in when the application was started.
The text was updated successfully, but these errors were encountered: