mirror of
https://github.com/msfjarvis/text-editor.git
synced 2024-06-03 04:18:57 +05:30
fix(terminal): disable raw mode when exiting
This commit is contained in:
parent
1491c0a44f
commit
d203222447
|
@ -4,7 +4,7 @@ use crossterm::{
|
|||
event::{read, Event, KeyEvent},
|
||||
execute,
|
||||
style::{self, Color, ResetColor},
|
||||
terminal::{enable_raw_mode, size, Clear, ClearType},
|
||||
terminal::{disable_raw_mode, enable_raw_mode, size, Clear, ClearType},
|
||||
};
|
||||
use std::io::{self, stdout, Error, Write};
|
||||
|
||||
|
@ -17,6 +17,13 @@ pub struct Terminal {
|
|||
size: Size,
|
||||
}
|
||||
|
||||
#[allow(unused_must_use)]
|
||||
impl Drop for Terminal {
|
||||
fn drop(&mut self) {
|
||||
disable_raw_mode();
|
||||
}
|
||||
}
|
||||
|
||||
impl Terminal {
|
||||
pub fn default() -> Result<Self, Error> {
|
||||
let (cols, rows) = size()?;
|
||||
|
|
Loading…
Reference in New Issue
Block a user