vt: combining chars: ensure 'key' is within range

When there's a key collision, we increment the key and check
again. When doing this, we need to ensure the key is withing range,
and wrap around to 0 if the key value is too large.
This commit is contained in:
Daniel Eklöf 2025-01-18 10:22:24 +01:00
parent 10c4e94e1b
commit 22e1b1610f
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

2
vt.c
View file

@ -845,6 +845,7 @@ action_utf8_print(struct terminal *term, char32_t wc)
cc->chars[0], base, cc->count, wanted_count, cc->chars[wanted_count - 1], wc); cc->chars[0], base, cc->count, wanted_count, cc->chars[wanted_count - 1], wc);
#endif #endif
key++; key++;
key &= CELL_COMB_CHARS_HI - CELL_COMB_CHARS_LO;
collision_count++; collision_count++;
continue; continue;
} }
@ -856,6 +857,7 @@ action_utf8_print(struct terminal *term, char32_t wc)
if (!match) { if (!match) {
key++; key++;
key &= CELL_COMB_CHARS_HI - CELL_COMB_CHARS_LO;
collision_count++; collision_count++;
continue; continue;
} }