summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-02-05 15:14:45 +0100
committerDavid Herrmann <dh.herrmann@googlemail.com>2012-02-05 15:14:45 +0100
commitd3951da8656c9ff9a6547aea687b71a98e66cec1 (patch)
tree5876803cdf33aeedc77fc89184b21d7ceb7e3ad9 /src
parentb02e8c833206a8a9397f53e05b698676cf42be4c (diff)
console: add helper to erase current position
This helper erases the current cursor position. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Diffstat (limited to 'src')
-rw-r--r--src/console.c16
-rw-r--r--src/console.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/src/console.c b/src/console.c
index 3209986..dccba24 100644
--- a/src/console.c
+++ b/src/console.c
@@ -422,6 +422,22 @@ void kmscon_console_move_line_home(struct kmscon_console *con)
con->cursor_x = 0;
}
+void kmscon_console_erase_cursor(struct kmscon_console *con)
+{
+ unsigned int x;
+
+ if (!con)
+ return;
+
+ if (con->cursor_x >= con->cells_x)
+ x = con->cells_x - 1;
+ else
+ x = con->cursor_x;
+
+ kmscon_buffer_erase_region(con->cells, x, con->cursor_y,
+ x, con->cursor_y);
+}
+
void kmscon_console_erase_cursor_to_end(struct kmscon_console *con)
{
unsigned int x;
diff --git a/src/console.h b/src/console.h
index 54d7936..17e6af4 100644
--- a/src/console.h
+++ b/src/console.h
@@ -101,6 +101,7 @@ void kmscon_console_move_left(struct kmscon_console *con, unsigned int num);
void kmscon_console_move_right(struct kmscon_console *con, unsigned int num);
void kmscon_console_move_line_end(struct kmscon_console *con);
void kmscon_console_move_line_home(struct kmscon_console *con);
+void kmscon_console_erase_cursor(struct kmscon_console *con);
void kmscon_console_erase_cursor_to_end(struct kmscon_console *con);
void kmscon_console_erase_home_to_cursor(struct kmscon_console *con);
void kmscon_console_erase_current_line(struct kmscon_console *con);