aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-03-15 16:39:43 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-03-18 16:12:11 +0000
commit9fcf5977c05686d55892d32fa3f980b03ef1b30a (patch)
tree88f39aafbe8a5af719d5b55a4b3e2dbb1d8c3125
parentsixel: hopefully handle image height correctly when trimming (diff)
sixel: fix cursor positioning when image is split up into several
-rw-r--r--sixel.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sixel.c b/sixel.c
index c9df4ab4..01f45d6b 100644
--- a/sixel.c
+++ b/sixel.c
@@ -1310,8 +1310,11 @@ sixel_unhook(struct terminal *term)
* Position the text cursor based on the text row
* touched by the last sixel
*/
+ const int pixel_rows = pixel_rows_left > 0
+ ? image.original.height
+ : term->sixel.pos.row;
const int term_rows =
- (image.original.height + term->cell_height - 1) / term->cell_height;
+ (pixel_rows + term->cell_height - 1) / term->cell_height;
xassert(term_rows <= image.rows);
@@ -1324,6 +1327,8 @@ sixel_unhook(struct terminal *term)
? min(image.pos.col + image.cols, term->cols - 1)
: image.pos.col));
}
+
+ term->sixel.pos.row -= image.original.height;
}
/* Dirty touched cells, and scroll terminal content if necessary */