console: add newline function

kmscon_console_newline() can be used to produce a newline. Writing \n doesn't
work as this would write \n as character into the cell and not produce a
newline.
The console does not perform any parsing so we provide a separate function.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2011-12-26 14:24:31 +01:00
parent e9a492ff44
commit 676b03cb5c
2 changed files with 14 additions and 0 deletions

View File

@ -375,3 +375,16 @@ void kmscon_console_write(struct kmscon_console *con,
kmscon_buffer_write(con->cells, con->cursor_x, con->cursor_y, ch);
con->cursor_x++;
}
void kmscon_console_newline(struct kmscon_console *con)
{
if (!con)
return;
con->cursor_x = 0;
con->cursor_y++;
if (con->cursor_y >= con->cells_y) {
con->cursor_y--;
kmscon_buffer_rotate(con->cells);
}
}

View File

@ -104,3 +104,4 @@ void kmscon_console_map(struct kmscon_console *con);
void kmscon_console_write(struct kmscon_console *con,
const struct kmscon_char *ch);
void kmscon_console_newline(struct kmscon_console *con);