gardesk/garterm / 2016465

Browse files

fix: preserve cursor state on restore (DECRC)

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
201646543968fdbcd5728f4dc1c68968e31f63e8
Parents
127ff5d
Tree
613bb3d

1 changed file

StatusFile+-
M garterm/src/terminal/cursor.rs 6 2
garterm/src/terminal/cursor.rsmodified
@@ -76,11 +76,15 @@ impl Cursor {
7676
     }
7777
 
7878
     /// Restore cursor state (DECRC)
79
+    ///
80
+    /// Important: The saved state is preserved (not consumed) so multiple
81
+    /// restores return to the same position. This matches xterm behavior
82
+    /// where shells rely on being able to restore multiple times.
7983
     pub fn restore(&mut self) -> Option<(CellAttrs, CellColor, CellColor, bool, bool)> {
80
-        self.saved.take().map(|s| {
84
+        self.saved.as_ref().map(|s| {
8185
             self.row = s.row;
8286
             self.col = s.col;
83
-            (s.attrs, s.fg, s.bg, s.origin_mode, s.autowrap)
87
+            (s.attrs.clone(), s.fg, s.bg, s.origin_mode, s.autowrap)
8488
         })
8589
     }
8690