Skip to content

Commit

Permalink
Remove enable/disable raw mode because mouse capture does it for us
Browse files Browse the repository at this point in the history
  • Loading branch information
martindisch committed Mar 21, 2024
1 parent 174d9c8 commit 5024c2c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ use crossterm::event::{
DisableMouseCapture, EnableMouseCapture, KeyCode, KeyEvent, KeyEventKind, KeyModifiers,
MouseButton, MouseEvent, MouseEventKind,
};
use crossterm::terminal::{
disable_raw_mode, enable_raw_mode, is_raw_mode_enabled, EnterAlternateScreen,
LeaveAlternateScreen,
};
use crossterm::terminal::{is_raw_mode_enabled, EnterAlternateScreen, LeaveAlternateScreen};
use ratatui::backend::{Backend, TestBackend};
use ratatui::buffer::Buffer;
use ratatui::style::{Color, Modifier, Style};
Expand Down Expand Up @@ -511,14 +508,12 @@ impl<'state, 'input> Recorder<'state, 'input> {
if !is_raw_mode_enabled().map_err(RecordError::SetUpTerminal)? {
crossterm::execute!(io::stdout(), EnterAlternateScreen, EnableMouseCapture)
.map_err(RecordError::SetUpTerminal)?;
enable_raw_mode().map_err(RecordError::SetUpTerminal)?;
}
Ok(())
}

fn clean_up_crossterm() -> Result<(), RecordError> {
if is_raw_mode_enabled().map_err(RecordError::CleanUpTerminal)? {
disable_raw_mode().map_err(RecordError::CleanUpTerminal)?;
crossterm::execute!(io::stdout(), LeaveAlternateScreen, DisableMouseCapture)
.map_err(RecordError::CleanUpTerminal)?;
}
Expand Down

0 comments on commit 5024c2c

Please sign in to comment.