From bdf032898eec7ce085793aabe7e328408393de0d Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Sat, 14 Jul 2012 20:00:06 +0200 Subject: [PATCH] console: fix invalid cursor state after resize Set cursor state to next valid position on resize to avoid invalid cursor states. Signed-off-by: David Herrmann --- src/console.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/console.c b/src/console.c index 9c421a2..f40c72e 100644 --- a/src/console.c +++ b/src/console.c @@ -544,6 +544,11 @@ int kmscon_console_resize(struct kmscon_console *con, unsigned int x, con->margin_top = 0; con->margin_bottom = con->size_y - 1; + if (con->cursor_x >= con->size_x) + con->cursor_x = con->size_x - 1; + if (con->cursor_y >= con->size_y) + con->cursor_y = con->size_y - 1; + return 0; }