render: use column count from grapheme instead of first glyph, when we have one

This commit is contained in:
Daniel Eklöf 2021-05-30 19:37:53 +02:00
parent 6c70cd9366
commit bd98cb6a73
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -507,6 +507,7 @@ render_cell(struct terminal *term, pixman_image_t *pix,
unsigned glyph_count = 0;
wchar_t base = cell->wc;
int cell_cols;
if (base != 0) {
if (unlikely(
@ -553,6 +554,7 @@ render_cell(struct terminal *term, pixman_image_t *pix,
glyph_count = 1;
glyphs = &single;
cell_cols = single->cols;
}
else if (base >= CELL_COMB_CHARS_LO &&
@ -571,7 +573,9 @@ render_cell(struct terminal *term, pixman_image_t *pix,
composed = NULL;
glyphs = grapheme->glyphs;
glyph_count = grapheme->count;
}
cell_cols = grapheme->cols;
} else
base = composed->chars[0];
}
@ -580,12 +584,14 @@ render_cell(struct terminal *term, pixman_image_t *pix,
single = fcft_glyph_rasterize(font, base, term->font_subpixel);
glyph_count = 1;
glyphs = &single;
cell_cols = single->cols;
}
}
assert(glyph_count == 0 || glyphs != NULL);
const int cols_left = term->cols - col;
int cell_cols = glyph_count > 0 ? max(1, min(glyphs[0]->cols, cols_left)) : 1;
cell_cols = max(1, min(cell_cols, cols_left));
/*
* Hack!