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.
This commit is contained in:
Daniel Eklöf 2024-03-15 15:11:44 +01:00
parent cc660bc7c1
commit cb820a498b
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 85 additions and 2 deletions

View file

@ -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;