From abb4deb4b892aeeee922a61d353f44a257628ed1 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Sat, 14 Jul 2012 14:20:39 +0200 Subject: [PATCH] console: fix tab ruler to be horizontal Whoops, current tab ruler turned out to be vertical. That's definitely not what we want. Therefore, turn it around to be horizontal so we can correctly move forward/backward in the console. Signed-off-by: David Herrmann --- src/console.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/console.c b/src/console.c index d94e99c..40c538a 100644 --- a/src/console.c +++ b/src/console.c @@ -477,11 +477,6 @@ int kmscon_console_resize(struct kmscon_console *con, unsigned int x, * lines. Otherwise, if this function fails in later turns, we will have * invalid lines in the buffer. */ if (y > con->line_num) { - tab_ruler = realloc(con->tab_ruler, sizeof(bool) * y); - if (!tab_ruler) - return -ENOMEM; - con->tab_ruler = tab_ruler; - cache = realloc(con->lines, sizeof(struct line*) * y); if (!cache) return -ENOMEM; @@ -504,6 +499,11 @@ int kmscon_console_resize(struct kmscon_console *con, unsigned int x, * will guarantee that all lines are big enough so we can resize the * buffer without reallocating them later. */ if (x > con->size_x) { + tab_ruler = realloc(con->tab_ruler, sizeof(bool) * x); + if (!tab_ruler) + return -ENOMEM; + con->tab_ruler = tab_ruler; + for (i = 0; i < con->line_num; ++i) { ret = line_resize(con, con->lines[i], x); if (ret) @@ -527,7 +527,7 @@ int kmscon_console_resize(struct kmscon_console *con, unsigned int x, console_scroll_up(con, con->size_y - y); /* reset tabs */ - for (i = 0; i < y; ++i) { + for (i = 0; i < x; ++i) { if (i % 8 == 0) con->tab_ruler[i] = true; else @@ -629,7 +629,7 @@ void kmscon_console_reset(struct kmscon_console *con) con->margin_top = 0; con->margin_bottom = con->size_y - 1; - for (i = 0; i < con->size_y; ++i) { + for (i = 0; i < con->size_x; ++i) { if (i % 8 == 0) con->tab_ruler[i] = true; else