mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
vt: fix utf-8 bug: re-load 'current state' after processing a utf8 byte
This commit is contained in:
parent
a27868cd9f
commit
b8017a36de
1 changed files with 5 additions and 0 deletions
5
vt.c
5
vt.c
|
|
@ -187,6 +187,7 @@ action(struct terminal *term, enum action action, uint8_t c)
|
|||
//LOG_DBG("print: UTF8: %.*s", (int)term->vt.utf8.idx, term->vt.utf8.data);
|
||||
memcpy(cell->c, term->vt.utf8.data, term->vt.utf8.idx);
|
||||
cell->c[term->vt.utf8.idx] = '\0';
|
||||
memset(&term->vt.utf8, 0, sizeof(term->vt.utf8));
|
||||
} else {
|
||||
//LOG_DBG("print: ASCII: %c", c);
|
||||
cell->c[0] = c;
|
||||
|
|
@ -288,10 +289,14 @@ vt_from_slave(struct terminal *term, const uint8_t *data, size_t len)
|
|||
if (current_state == STATE_UTF8) {
|
||||
if (!process_utf8(term, data[i]))
|
||||
abort();
|
||||
|
||||
current_state = term->vt.state;
|
||||
if (current_state == STATE_UTF8)
|
||||
continue;
|
||||
|
||||
if (!action(term, ACTION_PRINT, 0))
|
||||
abort();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue