From f04e838d4afd1edde10552e4ade91780b0d52123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 8 Dec 2008 00:07:49 -0500 Subject: [PATCH] Skip escape codes for now. --- terminal.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/terminal.c b/terminal.c index f0cf76d9..dc43d6af 100644 --- a/terminal.c +++ b/terminal.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -59,6 +60,7 @@ struct terminal { struct buffer *buffer; GIOChannel *channel; uint32_t modifiers; + int state; }; static void @@ -123,6 +125,9 @@ idle_redraw(void *data) return FALSE; } +#define STATE_NORMAL 0 +#define STATE_SKIP_TO_ALPHA 1 + static void terminal_data(struct terminal *terminal, const char *data, size_t length) { @@ -131,6 +136,13 @@ terminal_data(struct terminal *terminal, const char *data, size_t length) for (i = 0; i < length; i++) { row = &terminal->data[terminal->row * (terminal->width + 1)]; + + if (terminal->state == STATE_SKIP_TO_ALPHA) { + if (isalpha(data[i])) + terminal->state = STATE_NORMAL; + continue; + } + switch (data[i]) { case '\r': terminal->column = 0; @@ -145,6 +157,9 @@ terminal_data(struct terminal *terminal, const char *data, size_t length) memset(&row[terminal->column], ' ', -terminal->column & 7); terminal->column = (terminal->column + 7) & ~7; break; + case '\e': + terminal->state = STATE_SKIP_TO_ALPHA; + break; default: if (terminal->column < terminal->width) row[terminal->column++] = data[i];