composed: insert: require key to be unique

This commit is contained in:
Daniel Eklöf 2021-06-24 19:12:25 +02:00
parent 4a6dea04c2
commit f20956ff1b
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 9 additions and 15 deletions

8
vt.c
View file

@ -761,11 +761,13 @@ action_utf8_print(struct terminal *term, wchar_t wc)
new_cc->width = grapheme_width;
term->composed_count++;
key = composed_insert(&term->composed, new_cc);
wc = CELL_COMB_CHARS_LO + key;
xassert(wc <= CELL_COMB_CHARS_HI);
composed_insert(&term->composed, new_cc);
wc = CELL_COMB_CHARS_LO + key;
width = grapheme_width;
xassert(wc >= CELL_COMB_CHARS_LO);
xassert(wc <= CELL_COMB_CHARS_HI);
goto out;
}
}