From bae3c871bb6f05271adba8885b394b86ba0798a8 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 15 Jan 2021 17:08:30 +0100 Subject: term/vt/csi: break out cursor save/restore to dedicated functions --- terminal.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index c05325ee..13f7a6f7 100644 --- a/terminal.c +++ b/terminal.c @@ -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 -- cgit v1.3