diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index 2c0463d8a..b3e03efa8 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -1343,13 +1343,13 @@ read_bytes(int fd, Screen *screen) { if (len < 0) { if (errno == EINTR || errno == EAGAIN) continue; if (errno != EIO) perror("Call to read() from child fd failed"); + vt_parser_commit_write(screen->vt_parser, 0); return false; } break; } vt_parser_commit_write(screen->vt_parser, len); - if (UNLIKELY(len == 0)) return false; - return true; + return len != 0; } diff --git a/kitty/vt-parser.c b/kitty/vt-parser.c index f1b814336..eadd2713e 100644 --- a/kitty/vt-parser.c +++ b/kitty/vt-parser.c @@ -1581,6 +1581,7 @@ vt_parser_create_write_buffer(Parser *p, size_t *sz) { PS *self = (PS*)p->state; uint8_t *ans; with_lock { + if (self->write.sz) fatal("vt_parser_create_write_buffer() called with an already existing write buffer"); *sz = BUF_SZ - self->read.sz; self->write.offset = self->read.sz; self->write.sz = *sz;