Add ability to suspend/activate raw mode on RawTerminal

This commit is contained in:
Nathan Lilienthal 2018-10-12 01:40:18 -04:00
parent d2945cd36c
commit b64b10f40b
1 changed files with 14 additions and 0 deletions

View File

@ -101,6 +101,20 @@ impl<W: Write> IntoRawMode for W {
} }
} }
impl<W: Write> RawTerminal<W> {
pub fn suspend_raw_mode(&self) -> io::Result<()> {
set_terminal_attr(&self.prev_ios)?;
Ok(())
}
pub fn activate_raw_mode(&self) -> io::Result<()> {
let mut ios = get_terminal_attr()?;
raw_terminal_attr(&mut ios);
set_terminal_attr(&ios)?;
Ok(())
}
}
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;