diff --git a/src/input.rs b/src/input.rs index 9c3e56c..33e41b7 100644 --- a/src/input.rs +++ b/src/input.rs @@ -1,5 +1,5 @@ use crossterm::event::{poll, read, Event, KeyCode}; -use crossterm::terminal::enable_raw_mode; +use crossterm::terminal::{disable_raw_mode, enable_raw_mode}; use std::time::Duration; /// InputModule retrieves the keys from the hardware or software input control module. @@ -89,3 +89,9 @@ impl InputModule for CrossTermInput { None } } + +impl Drop for CrossTermInput { + fn drop(&mut self) { + disable_raw_mode().expect("failed to disable terminal raw mode."); + } +} \ No newline at end of file