Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

to_alternate: Switch back to main screen if into_raw_mode fails #4

Merged
merged 1 commit into from
Oct 1, 2019

Conversation

andersk
Copy link
Contributor

@andersk andersk commented Sep 29, 2019

No description provided.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
@TimonPost
Copy link
Member

What is the motivation behind this change?

@zrzka
Copy link
Contributor

zrzka commented Sep 29, 2019

I would guess cleanup? If I ask for alternate screen in raw mode and the function fails, I, as a user, do not want to end up in an inconsistent state like alternate & no raw. Which is not something I asked for. It should give me both or nothing.

@andersk
Copy link
Contributor Author

andersk commented Sep 30, 2019

Right now if you run any Crossterm application that does to_alternate(true) with stdin piped in from something other than a terminal, the into_raw_mode call fails, and you end up stuck in alternate screen mode even after the application exits, which is an annoying condition that this wrapper type was supposed to avoid.

@zrzka
Copy link
Contributor

zrzka commented Sep 30, 2019

I'd merge this one as it's really useful and make the API / behavior more consistent.

@TimonPost
Copy link
Member

Yea this is very useful, thanks for the explanation!

@TimonPost TimonPost merged commit 8fe5b7f into crossterm-rs:master Oct 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants