aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-03-21 09:58:36 -0500
committerJesse Luehrs <doy@tozt.net>2013-03-21 09:58:36 -0500
commitf46dc35425f3cd16c3d05b859b0be15976212510 (patch)
treeca66e0c4d2bc109d2377a258ad5e58fd016ed0a4 /src
parent697ff228ce165c1964e985e26d6d7ef09e4a1a2c (diff)
downloadrust-term-f46dc35425f3cd16c3d05b859b0be15976212510.tar.gz
rust-term-f46dc35425f3cd16c3d05b859b0be15976212510.zip
this actually doesn't need state, rmcup is idempotent
Diffstat (limited to 'src')
-rw-r--r--src/term.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/term.rs b/src/term.rs
index 6a4d3b5..27fc8c9 100644
--- a/src/term.rs
+++ b/src/term.rs
@@ -9,12 +9,11 @@ use info::{init,escape,escape2};
struct Writer {
priv cleanup: bool,
- priv alternate: bool,
}
pub fn Writer (cleanup: bool) -> Writer {
init();
- Writer { cleanup: cleanup, alternate: false }
+ Writer { cleanup: cleanup }
}
impl Writer {
@@ -40,14 +39,12 @@ impl Writer {
}
}
- pub fn alternate_screen (&mut self, enable: bool) {
+ pub fn alternate_screen (&self, enable: bool) {
if enable {
io::print(escape("smcup"));
- self.alternate = true;
}
else {
io::print(escape("rmcup"));
- self.alternate = false;
}
}
}
@@ -55,9 +52,7 @@ impl Writer {
impl Drop for Writer {
fn finalize (&self) {
if self.cleanup {
- if self.alternate {
- io::print(escape("rmcup"));
- }
+ io::print(escape("rmcup"));
io::print(escape("sgr0"));
io::print(escape("cnorm"));
}