From cb10d10fd8e61094638960ecd9db687ee859cab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Thu, 4 Jul 2019 19:23:25 +0200 Subject: [PATCH] vt: implement save/restore cursor+attributes --- terminal.h | 1 + vt.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/terminal.h b/terminal.h index 71b59e4d..9349de01 100644 --- a/terminal.h +++ b/terminal.h @@ -102,6 +102,7 @@ struct vt { int left; } utf8; struct attributes attrs; + struct attributes saved_attrs; bool dim; }; diff --git a/vt.c b/vt.c index a427f67b..0c2cd1c7 100644 --- a/vt.c +++ b/vt.c @@ -567,6 +567,16 @@ esc_dispatch(struct terminal *term, uint8_t final) #endif switch (final) { + case '7': + term->saved_cursor = term->cursor; + term->vt.saved_attrs = term->vt.attrs; + break; + + case '8': + term->cursor = term->saved_cursor; + term->vt.attrs = term->vt.saved_attrs; + break; + case 'B': { /* Configure G0-G3 to use ASCII */ char param = term->vt.params.idx > 0 ? term->vt.params.v[0].value : '(';