summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2017-02-02 20:51:14 -0800
committerJoe Wilm <jwilm@users.noreply.github.com>2017-02-02 21:40:38 -0800
commit875167a51006944da1a397fd0131b9aa69bf9a02 (patch)
tree64b69b9593d69879470adff60186bb2103af3ff9 /src
parentd0283141b538610ccd0252916c6f842fe5146187 (diff)
Fix bug introduced with save/restore patch
Switching between main and alt grids should no longer clear the main grid.
Diffstat (limited to 'src')
-rw-r--r--src/term/mod.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs
index a69d3f66..3cf06b2c 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -683,13 +683,13 @@ impl Term {
}
pub fn swap_alt(&mut self) {
- self.alt = !self.alt;
- ::std::mem::swap(&mut self.grid, &mut self.alt_grid);
-
if self.alt {
let template = self.empty_cell;
self.grid.clear(|c| c.reset(&template));
}
+
+ self.alt = !self.alt;
+ ::std::mem::swap(&mut self.grid, &mut self.alt_grid);
}
/// Scroll screen down
@@ -1191,6 +1191,7 @@ impl ansi::Handler for Term {
ansi::Mode::SwapScreenAndSetRestoreCursor => {
self.save_cursor_position();
self.swap_alt();
+ self.save_cursor_position();
},
ansi::Mode::ShowCursor => self.mode.insert(mode::SHOW_CURSOR),
ansi::Mode::CursorKeys => self.mode.insert(mode::APP_CURSOR),
@@ -1212,6 +1213,7 @@ impl ansi::Handler for Term {
ansi::Mode::SwapScreenAndSetRestoreCursor => {
self.restore_cursor_position();
self.swap_alt();
+ self.restore_cursor_position();
},
ansi::Mode::ShowCursor => self.mode.remove(mode::SHOW_CURSOR),
ansi::Mode::CursorKeys => self.mode.remove(mode::APP_CURSOR),