diff --git a/examples/editor.rs b/examples/editor.rs index 0e59a19..0590ee3 100644 --- a/examples/editor.rs +++ b/examples/editor.rs @@ -1,7 +1,6 @@ use crossterm::event::{DisableMouseCapture, EnableMouseCapture}; use crossterm::terminal::{ - disable_raw_mode, enable_raw_mode, is_raw_mode_enabled, EnterAlternateScreen, - LeaveAlternateScreen, + disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen, }; use ratatui::backend::CrosstermBackend; use ratatui::layout::{Constraint, Direction, Layout}; @@ -157,10 +156,8 @@ impl<'a> Editor<'a> { return error!("USAGE: cargo run --example editor FILE1 [FILE2...]"); } let mut stdout = io::stdout(); - if !is_raw_mode_enabled()? { - enable_raw_mode()?; - crossterm::execute!(stdout, EnterAlternateScreen, EnableMouseCapture)?; - } + enable_raw_mode()?; + crossterm::execute!(stdout, EnterAlternateScreen, EnableMouseCapture)?; let backend = CrosstermBackend::new(stdout); let term = Terminal::new(backend)?; Ok(Self { @@ -352,9 +349,6 @@ impl<'a> Editor<'a> { impl<'a> Drop for Editor<'a> { fn drop(&mut self) { self.term.show_cursor().unwrap(); - if !is_raw_mode_enabled().unwrap() { - return; - } disable_raw_mode().unwrap(); crossterm::execute!( self.term.backend_mut(), diff --git a/examples/tuirs_editor.rs b/examples/tuirs_editor.rs index 7fa6389..05491c1 100644 --- a/examples/tuirs_editor.rs +++ b/examples/tuirs_editor.rs @@ -2,8 +2,7 @@ use crossterm_025 as crossterm; use crossterm::event::{DisableMouseCapture, EnableMouseCapture}; use crossterm::terminal::{ - disable_raw_mode, enable_raw_mode, is_raw_mode_enabled, EnterAlternateScreen, - LeaveAlternateScreen, + disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen, }; use std::borrow::Cow; use std::env; @@ -159,10 +158,8 @@ impl<'a> Editor<'a> { return error!("USAGE: cargo run --example editor FILE1 [FILE2...]"); } let mut stdout = io::stdout(); - if !is_raw_mode_enabled()? { - enable_raw_mode()?; - crossterm::execute!(stdout, EnterAlternateScreen, EnableMouseCapture)?; - } + enable_raw_mode()?; + crossterm::execute!(stdout, EnterAlternateScreen, EnableMouseCapture)?; let backend = CrosstermBackend::new(stdout); let term = Terminal::new(backend)?; Ok(Self { @@ -354,9 +351,6 @@ impl<'a> Editor<'a> { impl<'a> Drop for Editor<'a> { fn drop(&mut self) { self.term.show_cursor().unwrap(); - if !is_raw_mode_enabled().unwrap() { - return; - } disable_raw_mode().unwrap(); crossterm::execute!( self.term.backend_mut(),