Use the byte loader for normal mode

This commit is contained in:
Kovid Goyal 2023-11-08 19:46:19 +05:30
parent 43451b1287
commit 3f41b22011
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -317,8 +317,13 @@ dispatch_normal_mode_byte(PS *self, uint8_t ch) {
static void
consume_normal(PS *self) {
uint8_t ch = self->buf[self->read.pos++];
dispatch_normal_mode_byte(self, ch);
const unsigned sz = self->read.sz - self->read.pos;
byte_loader b; byte_loader_init(&b, self->buf + self->read.pos, sz);
while (b.num_left && self->vte_state == VTE_NORMAL) {
uint8_t ch = byte_loader_next(&b);
dispatch_normal_mode_byte(self, ch);
}
self->read.pos += sz - b.num_left;
}
// }}}