term: keep cursor state in grid, for now, but document that it _could_ be moved

This commit is contained in:
Daniel Eklöf 2021-01-15 18:02:17 +01:00
parent a63e7983dd
commit 2a012f86d8
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 8 additions and 2 deletions

2
csi.c
View file

@ -507,7 +507,6 @@ decset_decrst(struct terminal *term, unsigned param, bool enable)
term->grid = &term->alt;
/* Cursor retains its position from the normal grid */
/* TODO: dont need separate cursors */
term_cursor_to(
term,
min(term->normal.cursor.point.row, term->rows - 1),
@ -526,7 +525,6 @@ decset_decrst(struct terminal *term, unsigned param, bool enable)
term->grid = &term->normal;
/* Cursor retains its position from the alt grid */
/* TODO: dont need separate cursors */
term_cursor_to(
term, min(term->alt.cursor.point.row, term->rows - 1),
min(term->alt.cursor.point.col, term->cols - 1));

View file

@ -106,6 +106,14 @@ struct grid {
int offset;
int view;
/*
* Note: the cursor (not the *saved* cursor) could most likely be
* global state in the term struct.
*
* However, we have grid specific functions that does not have
* access to the owning term struct, but does need access to the
* cursor.
*/
struct cursor cursor;
struct cursor saved_cursor;