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:
commit
ce6b43d071
14
src/raw.rs
14
src/raw.rs
|
@ -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::*;
|
||||
|
|
Loading…
Reference in New Issue