aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/screen.rs')
-rw-r--r--src/screen.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/screen.rs b/src/screen.rs
index bdcdcae..d40e9ea 100644
--- a/src/screen.rs
+++ b/src/screen.rs
@@ -53,6 +53,7 @@ struct State {
alternate_grid: crate::grid::Grid,
attrs: crate::attrs::Attrs,
+ saved_attrs: crate::attrs::Attrs,
title: String,
icon_name: String,
@@ -70,6 +71,7 @@ impl State {
alternate_grid: crate::grid::Grid::new(size),
attrs: crate::attrs::Attrs::default(),
+ saved_attrs: crate::attrs::Attrs::default(),
title: String::default(),
icon_name: String::default(),
@@ -128,6 +130,16 @@ impl State {
self.clear_mode(Mode::AlternateScreen);
}
+ fn save_cursor(&mut self) {
+ self.grid_mut().save_cursor();
+ self.saved_attrs = self.attrs;
+ }
+
+ fn restore_cursor(&mut self) {
+ self.grid_mut().restore_cursor();
+ self.attrs = self.saved_attrs;
+ }
+
fn set_output(&mut self, output: Output) {
self.outputs.insert(output);
}
@@ -263,12 +275,12 @@ impl State {
// ESC 7
fn decsc(&mut self) {
- self.grid_mut().save_pos();
+ self.save_cursor();
}
// ESC 8
fn decrc(&mut self) {
- self.grid_mut().restore_pos();
+ self.restore_cursor();
}
// ESC =