mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
vt: lazily reset utf8 in action_utf8_*_entry
action_clear() is in the super hot code path. Avoid resetting utf8 state there, as utf8 input is relatively uncommon. Instead, reset it when we explicitly enter any of the utf8 collecting states, as this is exactly the point where we need it.
This commit is contained in:
parent
d1fc419e34
commit
3f3fff768a
1 changed files with 3 additions and 4 deletions
7
vt.c
7
vt.c
|
|
@ -109,7 +109,6 @@ action_clear(struct terminal *term)
|
|||
term->vt.params.idx = 0;
|
||||
term->vt.private[0] = 0;
|
||||
term->vt.private[1] = 0;
|
||||
term->vt.utf8.idx = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -512,21 +511,21 @@ action_put(struct terminal *term, uint8_t c)
|
|||
static void
|
||||
action_utf8_2_entry(struct terminal *term, uint8_t c)
|
||||
{
|
||||
assert(term->vt.utf8.idx == 0);
|
||||
term->vt.utf8.idx = 0;
|
||||
term->vt.utf8.data[term->vt.utf8.idx++] = c;
|
||||
}
|
||||
|
||||
static void
|
||||
action_utf8_3_entry(struct terminal *term, uint8_t c)
|
||||
{
|
||||
assert(term->vt.utf8.idx == 0);
|
||||
term->vt.utf8.idx = 0;
|
||||
term->vt.utf8.data[term->vt.utf8.idx++] = c;
|
||||
}
|
||||
|
||||
static void
|
||||
action_utf8_4_entry(struct terminal *term, uint8_t c)
|
||||
{
|
||||
assert(term->vt.utf8.idx == 0);
|
||||
term->vt.utf8.idx = 0;
|
||||
term->vt.utf8.data[term->vt.utf8.idx++] = c;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue