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

Assistance on transition to termwiz #1847

Closed
wants to merge 2 commits into from

Conversation

EpocSquadron
Copy link
Contributor

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.

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.
Comment on lines +252 to +261
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()
}
Copy link
Contributor

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.

Copy link
Member

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

Copy link
Member

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

@the-mikedavis the-mikedavis added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 18, 2022
@kirawi kirawi added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. A-helix-term Area: Helix term improvements and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 13, 2022
@EpocSquadron
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants