csi: overwrite “saved cursor” position when entering the alt screen

Verified with vttest 11.8.7.3 - XTerm Alternate Screen features
This commit is contained in:
Daniel Eklöf 2021-01-15 15:46:50 +01:00
parent c0a3f89775
commit b72f7401d5
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 14 additions and 0 deletions

View file

@ -80,6 +80,8 @@
(https://codeberg.org/dnkl/foot/issues/291).
* Sixel “current geometry” query response not being bounded by the
current window dimensions (fixes `lsix` output)
* Entering the alt screen did not update the normal screens “saved
cursor” position.
### Security

12
csi.c
View file

@ -493,6 +493,18 @@ decset_decrst(struct terminal *term, unsigned param, bool enable)
if (enable && term->grid != &term->alt) {
selection_cancel(term);
/*
* A cursor restore *after* returning from alt screen
* should restore the cursor from where it was when
* *entering* alt mode.
*
* I.e. entering alt mode overwrites the previous saved
* cursor position.
*
* Checked by vttest 11.8.7.3
*/
term->grid->saved_cursor = term->grid->cursor;
term->grid = &term->alt;
term_cursor_to(