return;
}
- if (!buf->current[y]) {
- while (buf->fill <= y) {
- ret = new_line(&line);
- if (ret) {
- log_warn("console: cannot allocate line "
- "(%d); dropping input\n", ret);
- return;
- }
- buf->current[buf->fill] = line;
- buf->fill++;
+ line = buf->current[y];
+ if (!line) {
+ ret = new_line(&line);
+ if (ret) {
+ log_warn("console: cannot allocate line (%d); dropping input\n", ret);
+ return;
}
+
+ buf->current[y] = line;
+ if (buf->fill <= y)
+ buf->fill = y + 1;
}
- line = buf->current[y];
if (x >= line->size) {
ret = resize_line(line, buf->size_x);
void kmscon_buffer_newline(struct kmscon_buffer *buf)
{
- struct line *line, *nl;
+ struct line *nl;
int ret;
if (!buf)
}
if (buf->fill >= buf->size_y) {
- line = buf->current[0];
- if (!line)
- return;
-
- link_to_scrollback(buf, line);
+ link_to_scrollback(buf, buf->current[0]);
memmove(buf->current, &buf->current[1],
(buf->size_y - 1) * sizeof(struct line*));
buf->current[buf->size_y - 1] = NULL;