From cb820a498bc8b9c3823f54d0452c2e5d30de1996 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 15 Mar 2024 15:11:44 +0100 Subject: sixel: RA region does not affect the text cursor position The raster attributes is, really, just a way to erase an area. And, if the sixel is transparent, it's a nop. The final text cursor position depends, not on our image size (which is based on RA), but on the final graphical cursor position. However, we do want to continue using it as a hint of the final image size, to be able to pre-allocate the backing buffer. So, here's what we do: * When trimming trailing transparent rows, only trim the *image*, if the graphical cursor is positioned on the last sixel row, *and* the sixel is transparent. * Opaque sixels aren't trimmed at all, since RA in this acts as an erase that fills the RA region with the background color. * The graphical cursor position is always adjusted (i.e. trimmed), since it affects the text cursor position. * The text cursor position is now calculated from the graphical cursor position, instead of the image height. --- terminal.h | 1 + 1 file changed, 1 insertion(+) (limited to 'terminal.h') diff --git a/terminal.h b/terminal.h index a0e3d9d4..953f3329 100644 --- a/terminal.h +++ b/terminal.h @@ -677,6 +677,7 @@ struct terminal { uint32_t *p; /* Pointer into data, for current position */ int width; /* Image width, in pixels */ int height; /* Image height, in pixels */ + int alloc_height; unsigned int bottom_pixel; } image; -- cgit v1.3