aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/term.rs11
-rw-r--r--test/rl.rs6
2 files changed, 6 insertions, 11 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"));
}
diff --git a/test/rl.rs b/test/rl.rs
index 86f6655..9b096b4 100644
--- a/test/rl.rs
+++ b/test/rl.rs
@@ -1,11 +1,11 @@
extern mod term;
use core::io::ReaderUtil;
-fn term_app (body: &fn (w: &mut term::Writer)) {
- let mut writer = term::Writer(true);
+fn term_app (body: &fn (w: &term::Writer)) {
+ let writer = term::Writer(true);
do term::ios::preserve {
writer.alternate_screen(true);
- body(&mut writer);
+ body(&writer);
}
}