Fix suspend sequence

In my kitty-based setup, I observed the following bug:

1. Run cove[1], a toss-based application, in a kitty tab
2. Exit cove
3. Start lazygit[2]
4. Stage some files and enter a commit message
5. Try to press enter and observe garbage appearing in the text box

The bug occurred reliably after running cove, but never occurred if cove
was not run in that tab.

This commit fixes the bug by making the suspend sequence undo the
unsuspend sequence's steps in reverse order.
This commit is contained in:
Joscha 2024-04-25 19:56:09 +02:00
parent 8556fd8176
commit ef6d75c23a
2 changed files with 3 additions and 2 deletions

View file

@ -15,6 +15,7 @@ Procedure when bumping the version number:
### Fixed
- Width measurements of ASCII control characters
- Toss messing up the terminal state
## v0.2.2 - 2024-01-14

View file

@ -68,12 +68,12 @@ impl Terminal {
/// presenting the next frame.
pub fn suspend(&mut self) -> io::Result<()> {
crossterm::terminal::disable_raw_mode()?;
self.out.execute(LeaveAlternateScreen)?;
#[cfg(not(windows))]
{
self.out.execute(DisableBracketedPaste)?;
self.out.execute(PopKeyboardEnhancementFlags)?;
self.out.execute(DisableBracketedPaste)?;
}
self.out.execute(LeaveAlternateScreen)?;
self.out.execute(Show)?;
Ok(())
}