sixel: implement private mode 8452 - cursor positioning after sixel

When disabled (the default), the cursor is positioned on a new line
after emitting a sixel image.

When enabled, the cursor is positioned to the right of the sixel
image.

Closes #363
This commit is contained in:
Daniel Eklöf 2021-02-16 19:11:38 +01:00
parent 9666d1d0b7
commit 03c675c6e2
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
5 changed files with 37 additions and 2 deletions

24
sixel.c
View file

@ -767,9 +767,29 @@ sixel_unhook(struct terminal *term)
{
row->cells[col].attrs.clean = 0;
}
term_linefeed(term);
if (i < image.rows - 1 || !term->sixel.cursor_right_of_graphics)
term_linefeed(term);
}
term_carriage_return(term);
/*
* Position cursor
*
* Private mode 8452 controls where we leave the cursor after
* emitting a sixel:
*
* When disabled (the default), the cursor is positioned on a
* new line.
*
* When enabled, the cursor is positioned to the right of the
* sixel.
*/
term_cursor_to(
term,
term->grid->cursor.point.row,
(term->sixel.cursor_right_of_graphics
? min(image.pos.col + image.cols, term->cols - 1)
: 0));
_sixel_overwrite_by_rectangle(
term, image.pos.row, image.pos.col, image.rows, image.cols);