From 2335596a1a73b874e1eb5b273b38f06743e46c87 Mon Sep 17 00:00:00 2001
From: Ticki <Ticki@users.noreply.github.com>
Date: Thu, 10 Mar 2016 16:24:41 +0100
Subject: [PATCH] TerminalRestorer -> RawTerminal

---
 src/control.rs |  4 +++-
 src/lib.rs     |  2 +-
 src/raw.rs     | 22 +++++++++++-----------
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/control.rs b/src/control.rs
index 7b65619d..1bcd41d8 100644
--- a/src/control.rs
+++ b/src/control.rs
@@ -44,7 +44,9 @@ pub trait TermWrite {
         self.csi(b"?25l")
     }
 
-    // TODO insert mode
+    // TODO
+    // fn mode
+
 
     /// Reset the rendition mode.
     ///
diff --git a/src/lib.rs b/src/lib.rs
index 3ad3d47d..8e06f549 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -28,7 +28,7 @@ mod error;
 pub use error::TerminalError;
 
 mod raw;
-pub use raw::{IntoRawMode, TerminalRestorer};
+pub use raw::{IntoRawMode, RawTerminal};
 
 mod size;
 pub use size::terminal_size;
diff --git a/src/raw.rs b/src/raw.rs
index 11fa5808..6c9912d1 100644
--- a/src/raw.rs
+++ b/src/raw.rs
@@ -6,12 +6,12 @@ use TerminalError;
 /// A terminal restorer, which keeps the previous state of the terminal, and restores it, when
 /// dropped.
 #[cfg(target_os = "redox")]
-pub struct TerminalRestorer<W> {
+pub struct RawTerminal<W> {
     output: W,
 }
 
 #[cfg(target_os = "redox")]
-impl<W: Write> Drop for TerminalRestorer<W> {
+impl<W: Write> Drop for RawTerminal<W> {
     fn drop(&mut self) {
         use TermControl;
         self.csi(b"R");
@@ -23,27 +23,27 @@ use termios::Termios;
 /// A terminal restorer, which keeps the previous state of the terminal, and restores it, when
 /// dropped.
 #[cfg(not(target_os = "redox"))]
-pub struct TerminalRestorer<W> {
+pub struct RawTerminal<W> {
     prev_ios: Termios,
     output: W,
 }
 
 #[cfg(not(target_os = "redox"))]
-impl<W> Drop for TerminalRestorer<W> {
+impl<W> Drop for RawTerminal<W> {
     fn drop(&mut self) {
         use termios::set_terminal_attr;
         set_terminal_attr(&mut self.prev_ios as *mut _);
     }
 }
 
-impl<W> Deref for TerminalRestorer<W> {
+impl<W> Deref for RawTerminal<W> {
     type Target = W;
 
     fn deref(&self) -> &W {
         &self.output
     }
 }
-impl<W> DerefMut for TerminalRestorer<W> {
+impl<W> DerefMut for RawTerminal<W> {
     fn deref_mut(&mut self) -> &mut W {
         &mut self.output
     }
@@ -56,12 +56,12 @@ pub trait IntoRawMode: Sized {
     /// Raw mode means that stdin won't be printed (it will instead have to be written manually by the
     /// program). Furthermore, the input isn't canonicalised or buffered (that is, you can read from
     /// stdin one byte of a time). The output is neither modified in any way.
-    fn into_raw_mode(self) -> Result<TerminalRestorer<Self>, TerminalError>;
+    fn into_raw_mode(self) -> Result<RawTerminal<Self>, TerminalError>;
 }
 
 impl<W: Write> IntoRawMode for W {
     #[cfg(not(target_os = "redox"))]
-    fn into_raw_mode(self) -> Result<TerminalRestorer<W>, TerminalError> {
+    fn into_raw_mode(self) -> Result<RawTerminal<W>, TerminalError> {
         use termios::{cfmakeraw, get_terminal_attr, set_terminal_attr};
 
         let (mut ios, err) = get_terminal_attr();
@@ -77,20 +77,20 @@ impl<W: Write> IntoRawMode for W {
         if set_terminal_attr(&mut ios as *mut _) != 0 {
             Err(TerminalError::SetAttrError)
         } else {
-            Ok(TerminalRestorer {
+            Ok(RawTerminal {
                 prev_ios: prev_ios,
                 output: self,
             })
         }
     }
     #[cfg(target_os = "redox")]
-    fn into_raw_mode(self) -> Result<TerminalRestorer<W>, TerminalError> {
+    fn into_raw_mode(self) -> Result<RawTerminal<W>, TerminalError> {
         use TermControl;
 
         if let Err(_) = self.csi("r") {
             Err(TerminalError::StdoutError)
         } else {
-            Ok(TerminalRestorer {
+            Ok(RawTerminal {
                 output: self,
             })
         }
-- 
GitLab