term/vt/csi: break out cursor save/restore to dedicated functions

This commit is contained in:
Daniel Eklöf 2021-01-15 17:08:30 +01:00
parent c0a3f89775
commit bae3c871bb
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 15 additions and 10 deletions

View file

@ -2254,13 +2254,25 @@ term_reset_view(struct terminal *term)
term_damage_view(term);
}
void
term_save_cursor(struct terminal *term)
{
term->grid->saved_cursor = term->grid->cursor;
term->vt.saved_attrs = term->vt.attrs;
term->saved_charsets = term->charsets;
}
void
term_restore_cursor(struct terminal *term, const struct cursor *cursor)
{
int row = min(cursor->point.row, term->rows - 1);
int col = min(cursor->point.col, term->cols - 1);
term_cursor_to(term, row, col);
term->grid->cursor.lcf = cursor->lcf;
term->vt.attrs = term->vt.saved_attrs;
term->charsets = term->saved_charsets;
}
void