console: implement console soft-reset
authorDavid Herrmann <dh.herrmann@googlemail.com>
Sat, 14 Jul 2012 12:12:51 +0000 (14:12 +0200)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Sat, 14 Jul 2012 12:12:51 +0000 (14:12 +0200)
On soft-reset we reset the console to the initial state but keep current
line-state. That is, scrollback and cursor position are kept but the
non-visible state is reset.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
src/console.c
src/vte.c

index c21f43b..d94e99c 100644 (file)
@@ -620,10 +620,21 @@ void kmscon_console_clear_sb(struct kmscon_console *con)
 
 void kmscon_console_reset(struct kmscon_console *con)
 {
+       unsigned int i;
+
        if (!con)
                return;
 
-       /* TODO: reset console */
+       con->flags = 0;
+       con->margin_top = 0;
+       con->margin_bottom = con->size_y - 1;
+
+       for (i = 0; i < con->size_y; ++i) {
+               if (i % 8 == 0)
+                       con->tab_ruler[i] = true;
+               else
+                       con->tab_ruler[i] = false;
+       }
 }
 
 void kmscon_console_set_flags(struct kmscon_console *con, unsigned int flags)
index 0dc6b76..dfef0c5 100644 (file)
--- a/src/vte.c
+++ b/src/vte.c
@@ -373,9 +373,8 @@ void kmscon_vte_reset(struct kmscon_vte *vte)
        vte->flags |= FLAG_AUTO_REPEAT_MODE;
        vte->flags |= FLAG_SEND_RECEIVE_MODE;
        vte->flags |= FLAG_AUTO_WRAP_MODE;
-       kmscon_console_reset_flags(vte->con, ~0);
+       kmscon_console_reset(vte->con);
        kmscon_console_set_flags(vte->con, KMSCON_CONSOLE_AUTO_WRAP);
-       kmscon_console_set_margins(vte->con, 0, 0);
 
        kmscon_utf8_mach_reset(vte->mach);
        vte->state = STATE_GROUND;