From 875167a51006944da1a397fd0131b9aa69bf9a02 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Thu, 2 Feb 2017 20:51:14 -0800 Subject: [PATCH] Fix bug introduced with save/restore patch Switching between main and alt grids should no longer clear the main grid. --- src/term/mod.rs | 8 +++++--- 1 file 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),