mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-25 06:46:36 -04:00
sixel: place cursor on the last row touched by the sixel
Before this patch, we implemented the DEC algorithm strictly, which places the cursor on the text row touched by the *upper* pixel of the last sixel. Now, we place the cursor on the text row touched by the **bottom** pixel of the last sixel.
This commit is contained in:
parent
d3b348a5b1
commit
28ee19cd8c
1 changed files with 3 additions and 9 deletions
12
sixel.c
12
sixel.c
|
|
@ -1197,19 +1197,13 @@ sixel_unhook(struct terminal *term)
|
|||
int row = term->grid->cursor.point.row;
|
||||
|
||||
/*
|
||||
* Position the text cursor based on the **upper**
|
||||
* Position the text cursor based on the **bottom**
|
||||
* pixel, of the last sixel.
|
||||
*
|
||||
* In most cases, that'll end up being the very last
|
||||
* row of the sixel (which we're already at, thanks to
|
||||
* the linefeeds). But for some combinations of font
|
||||
* and image sizes, the final cursor position is
|
||||
* higher up.
|
||||
*/
|
||||
const int sixel_row_height = 6 * term->sixel.pan;
|
||||
const int sixel_rows = (image.original.height + sixel_row_height - 1) / sixel_row_height;
|
||||
const int upper_pixel_last_sixel = (sixel_rows - 1) * sixel_row_height;
|
||||
const int term_rows = (upper_pixel_last_sixel + term->cell_height - 1) / term->cell_height;
|
||||
const int bottom_pixel_last_sixel = sixel_rows * sixel_row_height - 1;
|
||||
const int term_rows = (bottom_pixel_last_sixel + term->cell_height - 1) / term->cell_height;
|
||||
|
||||
xassert(term_rows <= image.rows);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue