diff options
| author | Kristian Høgsberg <krh@redhat.com> | 2008-12-08 00:07:49 -0500 |
|---|---|---|
| committer | Kristian Høgsberg <krh@redhat.com> | 2008-12-08 00:07:49 -0500 |
| commit | f04e838d4afd1edde10552e4ade91780b0d52123 (patch) | |
| tree | 0d7601775e4d749bfddb554b97d2f96a608c191e | |
| parent | 6e83d58153c0bd6efd268dc5d76ee0f87fd3afb1 (diff) | |
Skip escape codes for now.
| -rw-r--r-- | terminal.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -29,6 +29,7 @@ #include <math.h> #include <time.h> #include <pty.h> +#include <ctype.h> #include <cairo.h> #include <glib.h> #include <linux/input.h> @@ -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]; |
