aboutsummaryrefslogtreecommitdiff
path: root/csi.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-06-23 13:03:06 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-06-23 13:03:22 +0000
commitde7dcf1a5c89bc296e5b96931cd0523b3b28c411 (patch)
treebed4cf46b7e06f47b2505380f231fc2986f1a386 /csi.c
parentvt: initial implementation of alt screen + 256 colors (diff)
csi: save and restore cursor when switching to and from alt screen
Diffstat (limited to 'csi.c')
-rw-r--r--csi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/csi.c b/csi.c
index 87886e66..b82b5c3b 100644
--- a/csi.c
+++ b/csi.c
@@ -423,7 +423,8 @@ csi_dispatch(struct terminal *term, uint8_t final)
if (term->grid.cells != term->grid.alt_grid) {
term->grid.cells = term->grid.alt_grid;
- /* TODO: save cursor position */
+ term->grid.alt_saved_cursor.row = term->grid.cursor.row;
+ term->grid.alt_saved_cursor.col = term->grid.cursor.col;
tll_free(term->grid.damage);
grid_erase(&term->grid, 0, term->grid.cols * term->grid.rows);
@@ -455,7 +456,10 @@ csi_dispatch(struct terminal *term, uint8_t final)
if (term->grid.cells == term->grid.alt_grid) {
term->grid.cells = term->grid.normal_grid;
- /* TODO: restore cursor position */
+ term->grid.cursor.row = term->grid.alt_saved_cursor.row;
+ term->grid.cursor.col = term->grid.alt_saved_cursor.col;
+ term->grid.linear_cursor = grid_cursor_linear(
+ &term->grid, term->grid.cursor.row, term->grid.cursor.col);
tll_free(term->grid.damage);
grid_damage_update(