summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/cons/cons.c11
-rw-r--r--sys/dev/cons/cons_ansi.c7
-rw-r--r--sys/include/dev/cons/ansi.h1
-rw-r--r--sys/include/dev/cons/cons.h1
4 files changed, 20 insertions, 0 deletions
diff --git a/sys/dev/cons/cons.c b/sys/dev/cons/cons.c
index 88f394b..ce2b154 100644
--- a/sys/dev/cons/cons.c
+++ b/sys/dev/cons/cons.c
@@ -422,6 +422,17 @@ cons_update_color(struct cons_screen *scr, uint32_t fg, uint32_t bg)
scr->bg = bg;
}
+void
+cons_reset_cursor(struct cons_screen *scr)
+{
+ HIDE_CURSOR(scr);
+ scr->ch_col = 0;
+ scr->ch_row = 0;
+ scr->curs_col = 0;
+ scr->curs_row = 0;
+ SHOW_CURSOR(scr);
+}
+
/*
* Put a character on the screen.
*
diff --git a/sys/dev/cons/cons_ansi.c b/sys/dev/cons/cons_ansi.c
index a91f1d3..4403f9c 100644
--- a/sys/dev/cons/cons_ansi.c
+++ b/sys/dev/cons/cons_ansi.c
@@ -88,6 +88,13 @@ ansi_feed(struct ansi_state *statep, char c)
statep->csi = 2;
statep->prev = c;
return c;
+ case 2:
+ if (c == 'H') {
+ cons_reset_cursor(&g_root_scr);
+ ansi_reset(statep);
+ return ANSI_UPDATE_CURSOR;
+ }
+ break;
}
if (!statep->set_fg && !statep->set_bg) {
diff --git a/sys/include/dev/cons/ansi.h b/sys/include/dev/cons/ansi.h
index 98d7618..f166458 100644
--- a/sys/include/dev/cons/ansi.h
+++ b/sys/include/dev/cons/ansi.h
@@ -46,6 +46,7 @@
/* ANSI_FEED update codes */
#define ANSI_UPDATE_COLOR -1
+#define ANSI_UPDATE_CURSOR -2
/*
* ANSI parser state machine.
diff --git a/sys/include/dev/cons/cons.h b/sys/include/dev/cons/cons.h
index 13153b2..9868493 100644
--- a/sys/include/dev/cons/cons.h
+++ b/sys/include/dev/cons/cons.h
@@ -68,6 +68,7 @@ void cons_init(void);
void cons_expose(void);
void cons_update_color(struct cons_screen *scr, uint32_t fg, uint32_t bg);
void cons_reset_color(struct cons_screen *scr);
+void cons_reset_cursor(struct cons_screen *scr);
int cons_putch(struct cons_screen *scr, char c);
int cons_putstr(struct cons_screen *scr, const char *s, size_t len);