Skip escape codes for now.

dev
Kristian Høgsberg 16 years ago
parent 6e83d58153
commit f04e838d4a
  1. 15
      terminal.c

@ -29,6 +29,7 @@
#include <math.h> #include <math.h>
#include <time.h> #include <time.h>
#include <pty.h> #include <pty.h>
#include <ctype.h>
#include <cairo.h> #include <cairo.h>
#include <glib.h> #include <glib.h>
#include <linux/input.h> #include <linux/input.h>
@ -59,6 +60,7 @@ struct terminal {
struct buffer *buffer; struct buffer *buffer;
GIOChannel *channel; GIOChannel *channel;
uint32_t modifiers; uint32_t modifiers;
int state;
}; };
static void static void
@ -123,6 +125,9 @@ idle_redraw(void *data)
return FALSE; return FALSE;
} }
#define STATE_NORMAL 0
#define STATE_SKIP_TO_ALPHA 1
static void static void
terminal_data(struct terminal *terminal, const char *data, size_t length) 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++) { for (i = 0; i < length; i++) {
row = &terminal->data[terminal->row * (terminal->width + 1)]; 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]) { switch (data[i]) {
case '\r': case '\r':
terminal->column = 0; 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); memset(&row[terminal->column], ' ', -terminal->column & 7);
terminal->column = (terminal->column + 7) & ~7; terminal->column = (terminal->column + 7) & ~7;
break; break;
case '\e':
terminal->state = STATE_SKIP_TO_ALPHA;
break;
default: default:
if (terminal->column < terminal->width) if (terminal->column < terminal->width)
row[terminal->column++] = data[i]; row[terminal->column++] = data[i];

Loading…
Cancel
Save