-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Assistance on transition to termwiz #1847
Conversation
This also switches us to the use of the alterate screen, in order to reproduce the behaviour of removing the editor's output from the screen on exit that we had in crossterm. Not sure if there are undesirable downstream effects of that though.
pub fn claim_term(&mut self) -> Result<(), termwiz::Error> { | ||
self.terminal.terminal().enter_alternate_screen()?; | ||
self.terminal.terminal().set_raw_mode() | ||
} | ||
|
||
pub(crate) fn clear(&mut self) -> Result<(), termwiz::Error> { | ||
let inner_term = self.terminal.terminal(); | ||
inner_term.exit_alternate_screen()?; | ||
inner_term.set_cooked_mode() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's kinda confusing that one is called claim_term
and the other clear
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be claim_term
and restore_term
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cursor methods should be similarly renamed from save_cursor
/load_cursor
I had bitten off more than I could chew, and found myself in a leadership position at work to boot, lowering my availability. Closing this for someone else to take on some day, or perhaps some crossterm work upstream as many of the reasons for this have since disappeared through other implementations (eg bracketed paste). |
This is intended as a working branch to share work towards replacing crossterm with termwiz.
I began with replacing the terminal claiming and restoring with termwiz' equivalent logic. Since termwiz keeps those mehtods on the terminal instance, I had to move the logic into the Compositor to get access. However, the panic handler is a bit tricky as I can't reach inside the compositor from within there, and since Termwiz puts the methods on the struct, I'm not really sure how to acheive the same result.