Add new helper to console subsystem which performs a backspace
operation. We must take care of auto-wrap mode so we cannot simply use
the *_move_left() function.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
}
}
+void kmscon_console_backspace(struct kmscon_console *con)
+{
+ if (!con)
+ return;
+
+ if (con->cursor_x >= con->cells_x) {
+ con->cursor_x = con->cells_x - 2;
+ } else if (con->cursor_x > 0) {
+ con->cursor_x--;
+ } else if (con->auto_wrap) {
+ con->cursor_x = con->cells_x - 1;
+ kmscon_console_move_up(con, 1, true);
+ }
+}
+
void kmscon_console_move_to(struct kmscon_console *con, unsigned int x,
unsigned int y)
{
void kmscon_console_write(struct kmscon_console *con, kmscon_symbol_t ch);
void kmscon_console_newline(struct kmscon_console *con);
+void kmscon_console_backspace(struct kmscon_console *con);
void kmscon_console_move_to(struct kmscon_console *con, unsigned int x,
unsigned int y);
void kmscon_console_move_up(struct kmscon_console *con, unsigned int num,
break;
case 0x08: /* BS */
/* Move cursor one position left */
+ kmscon_console_backspace(vte->con);
break;
case 0x09: /* HT */
/* Move to next tab stop or end of line */