mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
csi: add support for ?1047 and ?1048
* 1047 enters/leaves the alt screen, but without saving/restoring the cursor. * 1048 saves/restores the cursor * 1049 is 1047+1048 Note: when xtsaving and xtrestoring 1048, why simply save/restore the cursor. Without having read XTerms sources, this appears to be what it is doing.
This commit is contained in:
parent
bae3c871bb
commit
a63e7983dd
1 changed files with 27 additions and 8 deletions
35
csi.c
35
csi.c
|
|
@ -489,19 +489,31 @@ decset_decrst(struct terminal *term, unsigned param, bool enable)
|
|||
break;
|
||||
#endif
|
||||
|
||||
case 1048:
|
||||
if (enable)
|
||||
term_save_cursor(term);
|
||||
else
|
||||
term_restore_cursor(term, &term->grid->saved_cursor);
|
||||
break;
|
||||
|
||||
case 1047:
|
||||
case 1049:
|
||||
if (enable && term->grid != &term->alt) {
|
||||
selection_cancel(term);
|
||||
|
||||
if (param == 1049)
|
||||
term_save_cursor(term);
|
||||
|
||||
term->grid = &term->alt;
|
||||
|
||||
/* Cursor retains its position from the normal grid */
|
||||
/* TODO: don’t need separate cursors */
|
||||
term_cursor_to(
|
||||
term,
|
||||
min(term->grid->cursor.point.row, term->rows - 1),
|
||||
min(term->grid->cursor.point.col, term->cols - 1));
|
||||
|
||||
tll_free(term->alt.scroll_damage);
|
||||
min(term->normal.cursor.point.row, term->rows - 1),
|
||||
min(term->normal.cursor.point.col, term->cols - 1));
|
||||
|
||||
tll_free(term->normal.scroll_damage);
|
||||
term_erase(
|
||||
term,
|
||||
&(struct coord){0, 0},
|
||||
|
|
@ -513,12 +525,14 @@ decset_decrst(struct terminal *term, unsigned param, bool enable)
|
|||
|
||||
term->grid = &term->normal;
|
||||
|
||||
/* Cursor retains its position from the alt grid */
|
||||
/* TODO: don’t need separate cursors */
|
||||
term_cursor_to(
|
||||
term,
|
||||
min(term->grid->cursor.point.row, term->rows - 1),
|
||||
min(term->grid->cursor.point.col, term->cols - 1));
|
||||
term, min(term->alt.cursor.point.row, term->rows - 1),
|
||||
min(term->alt.cursor.point.col, term->cols - 1));
|
||||
|
||||
tll_free(term->alt.scroll_damage);
|
||||
if (param == 1049)
|
||||
term_restore_cursor(term, &term->grid->saved_cursor);
|
||||
|
||||
/* Delete all sixel images on the alt screen */
|
||||
tll_foreach(term->alt.sixel_images, it) {
|
||||
|
|
@ -526,6 +540,7 @@ decset_decrst(struct terminal *term, unsigned param, bool enable)
|
|||
tll_remove(term->alt.sixel_images, it);
|
||||
}
|
||||
|
||||
tll_free(term->alt.scroll_damage);
|
||||
term_damage_all(term);
|
||||
}
|
||||
break;
|
||||
|
|
@ -626,6 +641,8 @@ xtsave(struct terminal *term, unsigned param)
|
|||
case 1035: term->xtsave.num_lock_modifier = term->num_lock_modifier; break;
|
||||
case 1036: term->xtsave.meta_esc_prefix = term->meta.esc_prefix; break;
|
||||
case 1042: term->xtsave.bell_action_enabled = term->bell_action_enabled; break;
|
||||
case 1047: term->xtsave.alt_screen = term->grid == &term->alt; break;
|
||||
case 1048: term_save_cursor(term); break;
|
||||
case 1049: term->xtsave.alt_screen = term->grid == &term->alt; break;
|
||||
case 2004: term->xtsave.bracketed_paste = term->bracketed_paste; break;
|
||||
case 27127: term->xtsave.modify_escape_key = term->modify_escape_key; break;
|
||||
|
|
@ -661,6 +678,8 @@ xtrestore(struct terminal *term, unsigned param)
|
|||
case 1035: enable = term->xtsave.num_lock_modifier; break;
|
||||
case 1036: enable = term->xtsave.meta_esc_prefix; break;
|
||||
case 1042: enable = term->xtsave.bell_action_enabled; break;
|
||||
case 1047: enable = term->xtsave.alt_screen; break;
|
||||
case 1048: enable = true; break;
|
||||
case 1049: enable = term->xtsave.alt_screen; break;
|
||||
case 2004: enable = term->xtsave.bracketed_paste; break;
|
||||
case 27127: enable = term->xtsave.modify_escape_key; break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue