-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[BUG] Terminal settings aren't restored #3354
Comments
For reference, here's how I handled this in my own library: https://github.com/nineteendo/ansio/blob/125577e28362ed5395c3dafed38df763fa88b8c2/ansio/__init__.py |
is there any updates to this? |
Nope, this is one of the reasons why I don't use rich. |
The cursor state is something managed by the terminal. It can be modified outside of a Console object, which makes knowing how to "reset" it next to impossible. Additionally, to detect the cursor state, you would need to capture stdin, which Rich doesn't do as it would break the many project that do capture stdin. If you want control over the cursor state, put it in a try / finally, or a context manager. |
I hope we solved your problem. If you like using Rich, you might also enjoy Textual |
Can I detect that without using ansi escape codes? My library will always show the cursor on exit if you chose to hide it. |
In my project I'm not modifying the cursor at all. I've only used |
Don't call input when any of these objects are running. Input will block and write to the terminal at the same time as Rich, and there is no way for Rich to detect this. If you want a UI where you can get user input and update the screen, look in to a TUI framework like Textual. |
When |
Describe the bug
On exit
Rich doesn't restore the terminal back to its original settings when the program terminates:
On suspend
Rich doesn't restore the terminal back to its original settings when the program is suspended:
Platform
Click to expand
The text was updated successfully, but these errors were encountered: