mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-04 01:40:21 -05:00
unicode-combining: detect when we've reached the chain limit
We currently store up to 5 combining characters in any given base+combining chain. This adds a check for when that limit is about to be exceeded. When this happens, we log the chain + the new combining character. Since things will break anyway, we simply overwrite the last combining character.
This commit is contained in:
parent
b7ad4c2e2a
commit
1ebdc01162
1 changed files with 14 additions and 0 deletions
14
vt.c
14
vt.c
|
|
@ -641,6 +641,20 @@ action_utf8_print(struct terminal *term, uint8_t c)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
size_t wanted_count = composed != NULL ? composed->count + 1 : 1;
|
size_t wanted_count = composed != NULL ? composed->count + 1 : 1;
|
||||||
|
if (wanted_count > ALEN(composed->combining)) {
|
||||||
|
assert(composed != NULL);
|
||||||
|
|
||||||
|
LOG_WARN("combining character overflow:");
|
||||||
|
LOG_WARN(" base: 0x%04x", composed->base);
|
||||||
|
for (size_t i = 0; i < composed->count; i++)
|
||||||
|
LOG_WARN(" cc: 0x%04x", composed->combining[i]);
|
||||||
|
LOG_ERR(" new: 0x%04x", wc);
|
||||||
|
|
||||||
|
/* This are going to break anyway... */
|
||||||
|
wanted_count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(wanted_count <= ALEN(composed->combining));
|
||||||
|
|
||||||
/* Look for existing combining chain */
|
/* Look for existing combining chain */
|
||||||
for (size_t i = 0; i < term->composed_count; i++) {
|
for (size_t i = 0; i < term->composed_count; i++) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue