render: mark cell overflowed into as dirty

When tweak.allow-overflowing-double-width-glyphs=yes, then certain
glyphs are allowed to overflow into the neighbouring cell.

However, if the cell “owning” the double-width glyph is erased (_only_
that cell), then the cell overflowed into is not redrawn, causing
part of the double-width glyph to remain on screen.

To avoid checking for these glyphs when printing to the terminal (i.e
at parse time), simply mark both cells as dirty when we render the
overflowing glyph.

Yes, this means that the cells will always be re-rendered. We count on
them only making up a small portion of the screen.
This commit is contained in:
Daniel Eklöf 2021-01-02 22:24:49 +01:00
parent 94cacab2f9
commit 9c705b26ee
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 13 additions and 1 deletions

View file

@ -32,6 +32,9 @@
descriptor is closed.
* Crash on compositors not implementing the _text input_ interface
(https://codeberg.org/dnkl/foot/issues/259).
* Erased, overflowing glyphs (when
`tweak.allow-overflowing-double-width-glyphs=yes` - the default) not
properly erasing the cell overflowed **into**.
### Security

View file

@ -481,7 +481,16 @@ render_cell(struct terminal *term, pixman_image_t *pix,
col < term->cols - 1 &&
(row->cells[col + 1].wc == 0 || row->cells[col + 1].wc == L' '))
{
cell_cols = min(2, cols_left);
cell_cols = 2;
/*
* Ensure the cell were overflowing into gets re-rendered, to
* ensure it is erased if *this* cell is erased. Note that we
* do *not* mark the row as dirty - we dont need to re-render
* the cell if nothing else on the row has changed.
*/
row->cells[col].attrs.clean = 0;
row->cells[col + 1].attrs.clean = 0;
}
pixman_region32_t clip;