aboutsummaryrefslogtreecommitdiff
path: root/sixel.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-02-16 18:11:38 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-02-23 09:36:02 +0000
commit03c675c6e2d9152da363eefcb1a2c3b059aac2ba (patch)
treee6b4e6c85be33e749cde0880a2765be6c64b46cf /sixel.c
parentMerge branch 'sixel-private-color-registers' (diff)
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
Diffstat (limited to 'sixel.c')
-rw-r--r--sixel.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/sixel.c b/sixel.c
index 63ce493b..4f41348c 100644
--- a/sixel.c
+++ b/sixel.c
@@ -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);