From 7ca4b1c0537ec41f4b7b05ad61b48ff0bb29af8b Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Mon, 7 Jul 2025 00:58:55 +0000 Subject: kernel: ansi: Clear screen with "\033[2J" Signed-off-by: Ian Moffett --- sys/dev/cons/cons_ansi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'sys/dev/cons') diff --git a/sys/dev/cons/cons_ansi.c b/sys/dev/cons/cons_ansi.c index e00bdc9..69146b7 100644 --- a/sys/dev/cons/cons_ansi.c +++ b/sys/dev/cons/cons_ansi.c @@ -99,8 +99,17 @@ ansi_feed(struct ansi_state *statep, char c) statep->prev = c; return c; case 2: - if (c == 'H') { + if (c == '2') { + statep->csi = 3; + statep->prev = c; + return c; + } + break; + case 3: + /* Did we get '\033[2J' ? */ + if (statep->prev == '2' && c == 'J') { cons_clear_scr(scr, g_root_scr.bg); + ansi_reset(statep); return ANSI_UPDATE_CURSOR; } break; -- cgit v1.2.3