Merge branch 'suspend-raw' into 'master'

Add ability to suspend/activate raw mode on RawTerminal

See merge request redox-os/termion!150
This commit is contained in:
Jeremy Soller 2018-10-15 23:27:45 +00:00
commit ce6b43d071
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)]
mod test {
use super::*;