mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-03 07:15:29 -04:00
csi: save and restore cursor when switching to and from alt screen
This commit is contained in:
parent
199e4aa044
commit
de7dcf1a5c
2 changed files with 10 additions and 2 deletions
8
csi.c
8
csi.c
|
|
@ -423,7 +423,8 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
||||||
if (term->grid.cells != term->grid.alt_grid) {
|
if (term->grid.cells != term->grid.alt_grid) {
|
||||||
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);
|
tll_free(term->grid.damage);
|
||||||
grid_erase(&term->grid, 0, term->grid.cols * term->grid.rows);
|
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) {
|
if (term->grid.cells == term->grid.alt_grid) {
|
||||||
term->grid.cells = term->grid.normal_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);
|
tll_free(term->grid.damage);
|
||||||
grid_damage_update(
|
grid_damage_update(
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,10 @@ struct grid {
|
||||||
struct cell *cells;
|
struct cell *cells;
|
||||||
struct cell *normal_grid;
|
struct cell *normal_grid;
|
||||||
struct cell *alt_grid;
|
struct cell *alt_grid;
|
||||||
|
struct {
|
||||||
|
int row;
|
||||||
|
int col;
|
||||||
|
} alt_saved_cursor;
|
||||||
|
|
||||||
uint32_t foreground;
|
uint32_t foreground;
|
||||||
uint32_t background;
|
uint32_t background;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue