mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
vt: utf8: rotate instead of just shifting when updating compose key
This reduces the number of collisions in even more workloads.
This commit is contained in:
parent
88ce0e4375
commit
3bad062f8a
1 changed files with 7 additions and 4 deletions
11
vt.c
11
vt.c
|
|
@ -585,6 +585,13 @@ action_put(struct terminal *term, uint8_t c)
|
||||||
dcs_put(term, c);
|
dcs_put(term, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline uint32_t
|
||||||
|
chain_key(uint32_t old_key, uint32_t new_wc)
|
||||||
|
{
|
||||||
|
/* Rotate left 8 bits, xor with new char */
|
||||||
|
return ((old_key << 8) | (old_key >> (32 - 8))) ^ new_wc;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
action_utf8_print(struct terminal *term, wchar_t wc)
|
action_utf8_print(struct terminal *term, wchar_t wc)
|
||||||
{
|
{
|
||||||
|
|
@ -618,8 +625,6 @@ action_utf8_print(struct terminal *term, wchar_t wc)
|
||||||
? composed_lookup(term->composed, base - CELL_COMB_CHARS_LO)
|
? composed_lookup(term->composed, base - CELL_COMB_CHARS_LO)
|
||||||
: NULL;
|
: NULL;
|
||||||
|
|
||||||
#define chain_key(old, new) (((old) << 8) ^ (new))
|
|
||||||
|
|
||||||
uint32_t key;
|
uint32_t key;
|
||||||
|
|
||||||
if (composed != NULL) {
|
if (composed != NULL) {
|
||||||
|
|
@ -629,8 +634,6 @@ action_utf8_print(struct terminal *term, wchar_t wc)
|
||||||
} else
|
} else
|
||||||
key = chain_key(base, wc);
|
key = chain_key(base, wc);
|
||||||
|
|
||||||
#undef chain_key
|
|
||||||
|
|
||||||
key &= CELL_COMB_CHARS_HI - CELL_COMB_CHARS_LO;
|
key &= CELL_COMB_CHARS_HI - CELL_COMB_CHARS_LO;
|
||||||
|
|
||||||
#if defined(FOOT_GRAPHEME_CLUSTERING)
|
#if defined(FOOT_GRAPHEME_CLUSTERING)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue