Commit dd3ae0e8cf

dd3ae0e8cf3f533cea16eb9b5c82ebc216817478

parent: 73f1ef90d7

Unregistered key

Matthew Kabat <45803702+Nightchicken@users.noreply.github.com> · 2026-09-12 17:15 UTC
committer: <noreply@github.com>

Remove double tear down of alternate screen (#687)

Layout: unified · split

src/main.rs +4 −5
@@ -27,6 +27,7 @@ use clap::{CommandFactory, Parser};
2727use matrix_sdk::ruma::api::error::ErrorKind;
2828use matrix_sdk_crypto::encrypt_room_key_export;
2929use modalkit::actions::{Commandable, TabAction, TabContainer, TabCount, WindowContainer};
30use modalkit::crossterm;
3031use modalkit::crossterm::cursor::{SetCursorStyle, Show as CursorShow};
3132use modalkit::crossterm::event::{
3233 DisableBracketedPaste,
@@ -45,7 +46,6 @@ use modalkit::crossterm::event::{
4546 read,
4647};
4748use modalkit::crossterm::terminal::{EnterAlternateScreen, LeaveAlternateScreen, SetTitle};
48use modalkit::crossterm::{self, execute};
4949use modalkit::editing::key::KeyManager;
5050use modalkit::editing::store::Store;
5151use modalkit::keybindings::dialog::Pager;
@@ -787,10 +787,6 @@ impl Application {
787787 }
788788 }
789789
790 crossterm::terminal::disable_raw_mode()?;
791 execute!(self.terminal.backend_mut(), LeaveAlternateScreen)?;
792 self.terminal.show_cursor()?;
793
794790 return Ok(());
795791 }
796792}
@@ -1026,6 +1022,9 @@ fn setup_tty(settings: &ApplicationSettings, enable_enhanced_keys: bool) -> std:
10261022
10271023// Do our best to reverse what we did in setup_tty() when we exit or crash.
10281024fn restore_tty(enable_enhanced_keys: bool, enable_mouse: bool) {
1025 // The keyboard enhancement flags were pushed onto the alternate screen's
1026 // stack, which the terminal keeps separate from the main screen's, so they
1027 // have to be popped before LeaveAlternateScreen below.
10291028 if enable_enhanced_keys {
10301029 let _ = crossterm::queue!(stdout(), PopKeyboardEnhancementFlags);
10311030 }