aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ansi.c5
-rw-r--r--src/prototypes.h72
-rw-r--r--src/vt102.c481
-rw-r--r--src/vt102.h13
4 files changed, 443 insertions, 128 deletions
diff --git a/src/ansi.c b/src/ansi.c
index 5e70634..bdc3a56 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.5 2008/02/06 15:53:22 james
+ * *** empty log message ***
+ *
* Revision 1.4 2008/02/04 20:23:55 james
* *** empty log message ***
*
@@ -207,7 +210,7 @@ ansi_set_attr (ANSI * a, int attr)
}
if (dif & CRT_ATTR_BOLD)
{
- if (attr & CRT_ATTR_REVERSE)
+ if (attr & CRT_ATTR_BOLD)
{
ansi_write (a, "\033[1m", 4);
}
diff --git a/src/prototypes.h b/src/prototypes.h
index 56af551..9477d24 100644
--- a/src/prototypes.h
+++ b/src/prototypes.h
@@ -1,39 +1,51 @@
/* ansi.c */
-void ansi_write (ANSI * a, char *buf, int n);
-void ansi_getsize (ANSI * a);
-void ansi_move (ANSI * a, CRT_Pos p);
-void ansi_showhide_cursor (ANSI * a, int hide);
-void ansi_force_attr_normal (ANSI * a);
-void ansi_set_attr (ANSI * a, int attr);
-void ansi_render (ANSI * a, CRT_CA ca);
-void ansi_cls (ANSI * a);
-void ansi_draw (ANSI * a, CRT * c);
-void ansi_reset (ANSI * a);
+void ansi_write(ANSI *a, char *buf, int n);
+void ansi_getsize(ANSI *a);
+void ansi_move(ANSI *a, CRT_Pos p);
+void ansi_showhide_cursor(ANSI *a, int hide);
+void ansi_force_attr_normal(ANSI *a);
+void ansi_set_attr(ANSI *a, int attr);
+void ansi_render(ANSI *a, CRT_CA ca);
+void ansi_cls(ANSI *a);
+void ansi_draw(ANSI *a, CRT *c);
+void ansi_reset(ANSI *a);
/* crt.c */
-void crt_erase (CRT * c, CRT_Pos s, CRT_Pos e, int ea);
-void crt_cls (CRT * c);
-void crt_scroll_up (CRT * c, CRT_Pos s, CRT_Pos e, int ea);
-void crt_scroll_down (CRT * c, CRT_Pos s, CRT_Pos e, int ea);
-void crt_reset (CRT * c);
-void crt_insert (CRT * c, CRT_CA ca);
+void crt_erase(CRT *c, CRT_Pos s, CRT_Pos e, int ea);
+void crt_cls(CRT *c);
+void crt_scroll_up(CRT *c, CRT_Pos s, CRT_Pos e, int ea);
+void crt_scroll_down(CRT *c, CRT_Pos s, CRT_Pos e, int ea);
+void crt_reset(CRT *c);
+void crt_insert(CRT *c, CRT_CA ca);
/* html.c */
-void html_entity (FILE * f, int c);
-void html_render (FILE * f, CRT_CA c);
-void html_draw (FILE * f, CRT * c);
+void html_entity(FILE *f, int c);
+void html_render(FILE *f, CRT_CA c);
+void html_draw(FILE *f, CRT *c);
/* libsympathy.c */
struct termios old;
-void testy (void);
+void testy(void);
/* render.c */
/* testtty.c */
-int open_fd_to_bash (void);
+int open_fd_to_bash(void);
/* version.c */
/* vt102.c */
-void vt102_cursor_normalize (VT102 * v, int do_wrapscroll, int use_margins);
-void vt102_cursor_motion (VT102 * v, int x, int y, int wrapscroll);
-void vt102_delete_from_line (VT102 * v, CRT_Pos p);
-void vt102_parse_esc (VT102 * v, int c);
-void vt102_parse_csi (VT102 * v, char *buf, int len);
-void vt102_status_line (VT102 * v, char *str);
-void vt102_parse_char (VT102 * v, int c);
-void vt102_parser_reset (VT102_parser * p);
-void vt102_reset (VT102 * v);
+int vt102_inmargins(VT102 *v, CRT_Pos p);
+void vt102_clip_cursor(VT102 *v, CRT_Pos tl, CRT_Pos br);
+void vt102_cursor_normalize(VT102 *v);
+void vt102_cursor_advance_line(VT102 *v);
+void vt102_cursor_advance(VT102 *v);
+void vt102_cursor_retard(VT102 *v);
+void vt102_reset_tabs(VT102 *v);
+void vt102_cursor_advance_tab(VT102 *v);
+int vt102_cursor_home(VT102 *v);
+int vt102_cursor_absolute(VT102 *v, int x, int y);
+int vt102_cursor_relative(VT102 *v, int x, int y);
+void vt102_delete_from_line(VT102 *v, CRT_Pos p);
+void vt102_insert_into_line(VT102 *v, CRT_Pos p);
+void vt102_change_mode(VT102 *v, int private, char *ns, int set);
+void vt102_parse_mode_string(VT102 *v, char *buf, int len);
+void vt102_parse_esc(VT102 *v, int c);
+void vt102_parse_csi(VT102 *v, char *buf, int len);
+void vt102_status_line(VT102 *v, char *str);
+void vt102_parse_char(VT102 *v, int c);
+void vt102_parser_reset(VT102_parser *p);
+void vt102_reset(VT102 *v);
diff --git a/src/vt102.c b/src/vt102.c
index 1649c4f..84b544a 100644
--- a/src/vt102.c
+++ b/src/vt102.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.9 2008/02/06 15:53:22 james
+ * *** empty log message ***
+ *
* Revision 1.8 2008/02/06 11:49:47 james
* *** empty log message ***
*
@@ -78,8 +81,8 @@ CTRL-I
CTRL-J
CTRL-M
CTRL-N
-CTRL-O
+CTRL-O
ESC7
ESC8
ESCH
@@ -109,8 +112,6 @@ ESC[5m
ESC[7m
ESC[%d;%dr
-ESC(B
-ESC)0
ESC[?3l
ESC[?4l
@@ -120,11 +121,29 @@ ESC[?7h
ESC[?7l
ESC[?8h
+ESC(B
+ESC)0
+
+
+TODO:
+
+ESC(B
+ESC)0
+
+CTRL-O
+
+ESC7
+ESC8
+ESCH
+ESCM
+ESC>
+
*/
#include "project.h"
+
static inline int
csi_ender (int c)
{
@@ -148,85 +167,222 @@ csi_starter (int c)
return 0;
}
+static inline int
+in_margins (VT102 * v, CRT_Pos p)
+{
+ if (v->pos.x < v->top_margin.x)
+ return 0;
+ if (v->pos.y < v->top_margin.y)
+ return 0;
+
+ if (v->pos.x > v->bottom_margin.x)
+ return 0;
+ if (v->pos.y > v->bottom_margin.y)
+ return 0;
+
+ return 1;
+}
void
-vt102_cursor_normalize (VT102 * v, int do_wrapscroll, int use_margins)
+vt102_log_line (VT102 * v, int line)
{
- int wrap = do_wrapscroll ? 1 : 0;
- int scroll = do_wrapscroll ? 1 : 0;
- CRT_Pos *top, *bottom;
+ CRT_Pos e = { VT102_COLS - 1, line };
+ CRT_Pos p = { 0, line };
- if (use_margins)
+ for (; e.x > 0; --e.x)
{
- top = &v->top_margin;
- bottom = &v->bottom_margin;
+ if (v->crt.screen[CRT_ADDR_POS (&e)].chr != ' ')
+ break;
}
- else
+
+ for (; p.x <= e.x; ++p.x)
{
- top = &v->screen_start;
- bottom = &v->screen_end;
+ int c = v->crt.screen[CRT_ADDR_POS (&p)].chr;
+ if (c < 32)
+ c = ' ';
+ if (c > 126)
+ c = ' ';
+ fputc (c, stderr);
}
+ fputc ('\n', stderr);
+}
- if (v->pos.x < top->x) /*don't wrap backwards */
- v->pos.x = top->x;
+void
+vt102_clip_cursor (VT102 * v, CRT_Pos tl, CRT_Pos br)
+{
+ if (v->pos.x < tl.x)
+ v->pos.x = tl.x;
+ if (v->pos.y < tl.y)
+ v->pos.y = tl.y;
+
+ if (v->pos.x > br.x)
+ v->pos.x = br.x;
+ if (v->pos.y > br.y)
+ v->pos.y = br.y;
+}
+
+
+void
+vt102_cursor_normalize (VT102 * v)
+{
+ CRT_Pos *top, *bottom;
- if (v->pos.x > bottom->x)
+ if (v->private_modes[VT102_PRIVATE_MODE_ORIGIN_MODE])
{
- if (wrap)
- {
- v->pos.x = top->x;
- v->pos.y++;
- }
- else
- {
- v->pos.x = bottom->x;
- }
+ vt102_clip_cursor (v, v->top_margin, v->bottom_margin);
}
+ else
+ {
+ vt102_clip_cursor (v, v->screen_start, v->screen_end);
+ }
+}
- if (v->pos.y < top->y)
- v->pos.y = top->y;
- if (v->pos.y > bottom->y)
+void
+vt102_cursor_carriage_return (VT102 * v)
+{
+ /*FISH*/ v->pos.x = v->top_margin.x;
+ v->pending_wrap = 0;
+}
+
+void
+vt102_cursor_advance_line (VT102 * v)
+{
+ int couldscroll = in_margins (v, v->pos);
+
+/*have wraped off end of last line in scrolling region */
+/* (|| not necessary, but shuts compiler up */
+ if (((v->pos.y == v->bottom_margin.y) || (v->pos.y == v->screen_end.y)) &&
+ (couldscroll))
{
- if (scroll)
- crt_scroll_up (&v->crt, *top, *bottom, 1);
- v->pos.y = bottom->y;
+ vt102_log_line (v, v->pos.y);
+ crt_scroll_up (&v->crt, v->top_margin, v->bottom_margin, 1);
+ return;
}
+
+ v->pos.y++;
+ v->pending_wrap = 0;
}
void
-vt102_cursor_motion (VT102 * v, int x, int y, int wrapscroll)
+vt102_cursor_advance (VT102 * v)
{
- while (x > 0)
+
+ if (v->pos.x < v->bottom_margin.x)
{
- x--;
+/*Normal advance*/
v->pos.x++;
- vt102_cursor_normalize (v, wrapscroll, 1);
+ v->pending_wrap = 0;
+ return;
}
+ v->pending_wrap++;
+}
+
+
+void
+vt102_do_pending_wrap (VT102 * v)
+{
+ int couldscroll = in_margins (v, v->pos);
+ int autowrap = v->private_modes[VT102_PRIVATE_MODE_AUTO_WRAP];
+
+ if (!v->pending_wrap)
+ return;
- while (x < 0)
+#if 0
+ fprintf (stderr, "ca: (%d,%d) autowrap %d couldscroll %d\n", v->pos.x,
+ v->pos.y, autowrap, couldscroll);
+#endif
+
+/*End of line but no autowrap, nothing to do*/
+ if (!autowrap)
+ return;
+
+/*End of screen and not allowed to scroll, nothing to do*/
+ if ((v->pos.y == v->screen_end.y) && (!couldscroll))
+ return;
+
+ if (couldscroll)
{
- x++;
- v->pos.x--;
- vt102_cursor_normalize (v, wrapscroll, 1);
+ v->pos.x = v->top_margin.x;
}
+ else
+ {
+ v->pos.x = 0;
+ }
+
+ vt102_cursor_advance_line (v);
+}
+
- while (y > 0)
+void
+vt102_cursor_retard (VT102 * v)
+{
+ if (v->pos.x != v->top_margin.x)
+ v->pos.x--;
+
+ v->pending_wrap = 0;
+}
+
+void
+vt102_reset_tabs (VT102 * v)
+{
+ int i;
+
+ memset (v->tabs, 0, sizeof (v->tabs));
+
+ for (i = 0; i < VT102_COLS; i += 8)
{
- y--;
- v->pos.y++;
- vt102_cursor_normalize (v, wrapscroll, 1);
+ v->tabs[i]++;
}
+}
+void
+vt102_cursor_advance_tab (VT102 * v)
+{
+ if (v->pos.x == v->bottom_margin.x)
+ return;
+ while (v->pos.x < v->bottom_margin.x)
+ {
+ v->pos.x++;
+ if (v->tabs[v->pos.x])
+ break;
+ }
+ v->pending_wrap = 0;
+}
+
+vt102_cursor_home (VT102 * v)
+{
+ v->pos = v->top_margin;
+ vt102_cursor_normalize (v);
+ v->pending_wrap = 0;
+}
- while (y < 0)
+vt102_cursor_absolute (VT102 * v, int x, int y)
+{
+ if (v->private_modes[VT102_PRIVATE_MODE_ORIGIN_MODE])
+ {
+ v->pos.x = x + v->top_margin.x;
+ v->pos.y = y + v->top_margin.x;
+ }
+ else
{
- y++;
- v->pos.y--;
- vt102_cursor_normalize (v, wrapscroll, 1);
+ v->pos.x = x;
+ v->pos.y = y;
}
+ vt102_cursor_normalize (v);
+ v->pending_wrap = 0;
+}
+
+vt102_cursor_relative (VT102 * v, int x, int y)
+{
+ v->pos.x += x;
+ v->pos.y += y;
+ vt102_cursor_normalize (v);
+ v->pending_wrap = 0;
}
+
+
void
vt102_delete_from_line (VT102 * v, CRT_Pos p)
{
@@ -258,13 +414,15 @@ vt102_insert_into_line (VT102 * v, CRT_Pos p)
{
memmove (&v->crt.screen[CRT_ADDR_POS (&p) + 1],
- &v->crt.screen[CRT_ADDR_POS (&p) ], sizeof (CRT_CA) * n);
+ &v->crt.screen[CRT_ADDR_POS (&p)], sizeof (CRT_CA) * n);
}
v->crt.screen[CRT_ADDR (p.y, v->bottom_margin.x)].chr = ' ';
v->crt.screen[CRT_ADDR (p.y, v->bottom_margin.x)].attr = CRT_ATTR_NORMAL;
}
+
+
void
vt102_change_mode (VT102 * v, int private, char *ns, int set)
{
@@ -286,11 +444,22 @@ vt102_change_mode (VT102 * v, int private, char *ns, int set)
return;
if (private)
- v->private_modes[m] = set;
+ {
+ v->private_modes[m] = set;
+ switch (m)
+ {
+ case VT102_PRIVATE_MODE_ORIGIN_MODE:
+ vt102_cursor_home (v);
+ break;
+ }
+
+ }
else
v->modes[m] = set;
+#if 0
fprintf (stderr, "mode set=%d private=%d num=%d\n", set, private, m);
+#endif
}
void
@@ -341,12 +510,118 @@ vt102_parse_mode_string (VT102 * v, char *buf, int len)
}
+
void
-vt102_parse_esc (VT102 * v, int c)
+vt102_change_attr (VT102 * v, char *na)
{
- fprintf (stderr, "ESC 0%o(%c)\n", c, c);
+ int a;
+
+
+ if (*na)
+ {
+ a = atoi (na);
+ }
+ else
+ {
+ a = 0;
+ }
+
+ switch (a)
+ {
+ case 0:
+ v->attr = CRT_ATTR_NORMAL;
+ break;
+ case 1:
+ v->attr |= CRT_ATTR_BOLD;
+ break;
+ case 22:
+ v->attr &= ~CRT_ATTR_BOLD;
+ break;
+ case 4:
+ v->attr |= CRT_ATTR_UNDERLINE;
+ break;
+ case 24:
+ v->attr &= ~CRT_ATTR_UNDERLINE;
+ break;
+ case 5:
+ v->attr |= CRT_ATTR_BLINK;
+ break;
+ case 25:
+ v->attr &= ~CRT_ATTR_BLINK;
+ break;
+ case 7:
+ v->attr |= CRT_ATTR_REVERSE;
+ break;
+ case 27:
+ v->attr &= ~CRT_ATTR_REVERSE;
+ break;
+ default:
+ fprintf (stderr, "unhandled SGR %d\n", a);
+ }
+
}
+
+void
+vt102_parse_attr_string (VT102 * v, char *buf, int len)
+{
+ int private = 0;
+ char last = buf[len - 1];
+ char num[4];
+ int o;
+
+ memset (num, 0, sizeof (num));
+ o = sizeof (num) - 1;
+
+ len--;
+
+ if (len < 0)
+ return;
+
+ while (len--)
+ {
+ if (*buf == ';')
+ {
+ vt102_change_attr (v, &num[o]);
+ memset (num, 0, sizeof (num));
+ o = sizeof (num) - 1;
+ buf++;
+ continue;
+ }
+
+ num[0] = num[1];
+ num[1] = num[2];
+ num[2] = *buf;
+
+ if (o)
+ o--;
+
+ buf++;
+ }
+ vt102_change_attr (v, &num[o]);
+}
+
+void
+vt102_parse_esc (VT102 * v, int c)
+{
+
+ switch (c)
+ {
+#if 0
+ case '=':
+ case '>':
+ {
+ char s[] = { 033, c };
+/*Horrid hack for the moment in testing change the key mode of the upstream te*/
+ write (1, s, 2);
+ }
+ break;
+#endif
+ default:
+ fprintf (stderr, "unhandled ESC \\033 \\%03o (ESC %c)\n", c,
+ (c < 32) ? '?' : c);
+ }
+}
void
vt102_parse_csi (VT102 * v, char *buf, int len)
{
@@ -377,30 +652,33 @@ vt102_parse_csi (VT102 * v, char *buf, int len)
switch (last)
{
case 'A':
- vt102_cursor_motion (v, 0, -narg, 0);
+ vt102_cursor_relative (v, 0, -narg);
break;
case 'B':
- vt102_cursor_motion (v, 0, narg, 0);
+ vt102_cursor_relative (v, 0, narg);
break;
case 'C':
- vt102_cursor_motion (v, narg, 0, 0);
+ vt102_cursor_relative (v, narg, 0);
break;
case 'D':
- vt102_cursor_motion (v, -narg, 0, 0);
+ vt102_cursor_relative (v, -narg, 0);
break;
case 'H':
- v->pos.y = narg - 1;
+ {
+ int x, y;
+
+ y = narg - 1;
- ptr = index (arg, ';');
- if (ptr)
- v->pos.x = atoi (ptr + 1) - 1;
- else
- v->pos.x = 0;
+ ptr = index (arg, ';');
+ if (ptr)
+ x = atoi (ptr + 1) - 1;
+ else
+ x = 0;
- vt102_cursor_normalize (v, 0, 0);
+ vt102_cursor_absolute (v, x, y);
+ }
break;
case 'J':
- fprintf (stderr, "OCTOPUS %d\n", narg);
switch (narg)
{
case 1:
@@ -421,18 +699,12 @@ vt102_parse_csi (VT102 * v, char *buf, int len)
switch (narg)
{
case 0:
- fprintf (stderr, "FISH %d %d -> %d %d\n",
- v->pos.x, v->pos.y, le.x, le.y);
crt_erase (&v->crt, v->pos, le, 1);
break;
case 1:
- fprintf (stderr, "SOUP %d %d -> %d %d\n",
- ls.x, ls.y, v->pos.x, v->pos.y);
crt_erase (&v->crt, ls, v->pos, 1);
break;
case 2:
- fprintf (stderr, "TREE %d %d -> %d %d\n",
- ls.x, ls.y, le.x, le.y);
crt_erase (&v->crt, ls, le, 1);
break;
}
@@ -462,17 +734,27 @@ vt102_parse_csi (VT102 * v, char *buf, int len)
break;
case 'g':
- fprintf (stderr, "C: CSI %s buf[0]=%c\n", buf, buf[0]);
+ if (len == 2)
+ narg = 0; /*Different default */
+
+ switch (narg)
+ {
+ case 0:
+ v->tabs[v->pos.x] = 0;
+ break;
+ case 3:
+ memset (v->tabs, 0, sizeof (v->tabs));
+ break;
+ }
break;
case 'h':
case 'l':
- fprintf (stderr, "D: CSI %s buf[0]=%c\n", buf, buf[0]);
vt102_parse_mode_string (v, &buf[1], len - 1);
break;
case 'm':
- //horror of horrors parsing the ;
+ vt102_parse_attr_string (v, &buf[1], len - 1);
break;
case 'r':
v->top_margin = v->screen_start;
@@ -494,17 +776,15 @@ vt102_parse_csi (VT102 * v, char *buf, int len)
if (v->bottom_margin.y > v->screen_end.y)
v->bottom_margin.y = v->screen_end.y;
- fprintf (stderr, "D: %d %d\n", v->top_margin.y, v->bottom_margin.y);
-
- v->pos = v->top_margin;
+ vt102_cursor_home (v);
break;
default:
- fprintf (stderr, "A: CSI %s buf[0]=%c\n", buf, buf[0]);
+ fprintf (stderr, "unhandled CSI \\033%s\n", buf, buf[0]);
}
break;
default:
- fprintf (stderr, "B: CSI %s buf[0]=%c\n", buf, buf[0]);
+ fprintf (stderr, "unhandled CSI \\033%s\n", buf, buf[0]);
}
@@ -535,7 +815,7 @@ vt102_parse_char (VT102 * v, int c)
VT102_parser *p = &v->parser;
#if 0
- fprintf (stderr, "%c pc %d %d %d %d %d\n", (c > 31) ? 32 : c, c,
+ fprintf (stderr, "%c pc %d %d %d %d %d\n", (c < 32) ? 32 : c, c,
p->in_csi, p->in_escape, v->pos.x, v->pos.y);
#endif
if (p->in_csi)
@@ -577,22 +857,19 @@ vt102_parse_char (VT102 * v, int c)
/*BEL*/ case 7:
break;
/*BS*/ case 8:
- vt102_cursor_motion (v, -1, 0, 1);
+ vt102_cursor_retard (v);
break;
/*HT*/ case 9:
- v->pos.x += 8;
- v->pos.x &= ~7;
- vt102_cursor_normalize (v, 1, 1);
+ vt102_cursor_advance_tab (v);
break;
/*LF*/ case 10:
/*VT*/ case 11:
/*FF*/ case 12:
- vt102_cursor_motion (v, 0, 1, 1);
- if (v->modes[VT102_MODE_NEWLINE_MODE])
- v->pos.x = v->top_margin.x;
- break;
+ vt102_cursor_advance_line (v);
+ if (!v->modes[VT102_MODE_NEWLINE_MODE])
+ break;
/*CR*/ case 13:
- v->pos.x = v->top_margin.x;
+ vt102_cursor_carriage_return (v);
break;
/*SO*/ case 14:
/*SI*/ case 15:
@@ -618,18 +895,25 @@ vt102_parse_char (VT102 * v, int c)
/*DEL*/ case 127:
break;
/*regular character */ default:
+ vt102_do_pending_wrap (v);
- if (v->modes[VT102_MODE_INSERT])
- vt102_insert_into_line(v,v->pos);
+ if (v->modes[VT102_MODE_INSERT])
+ vt102_insert_into_line (v, v->pos);
v->crt.screen[CRT_ADDR_POS (&v->pos)].chr = c;
v->crt.screen[CRT_ADDR_POS (&v->pos)].attr = v->attr;
- vt102_cursor_motion (v, 1, 0, 1);
+ vt102_cursor_advance (v);
}
}
v->crt.pos = v->pos;
+ if (v->current_line.y != v->pos.y)
+ {
+ vt102_log_line (v, v->current_line.y);
+ v->current_line = v->pos;
+ }
+
vt102_status_line (v, "VT102 foo bar baz I'm the urban spaceman baby");
}
@@ -650,6 +934,10 @@ vt102_reset (VT102 * v)
crt_cls (&v->crt);
+
+ v->current_line = v->pos;
+ v->pending_wrap = 0;
+
v->screen_start.x = 0;
v->screen_start.y = 0;
v->screen_end.x = VT102_COLS - 1;
@@ -658,13 +946,14 @@ vt102_reset (VT102 * v)
v->top_margin = v->screen_start;
v->bottom_margin = v->screen_end;
- v->pos = v->screen_start;
-
- memset(v->modes,0,VT102_NMODES);
- memset(v->private_modes,0,VT102_NMODES);
+ memset (v->modes, 0, VT102_NMODES);
+ memset (v->private_modes, 0, VT102_NMODES);
- v->modes[VT102_PRIVATE_MODE_AUTO_WRAP]=1;
- v->modes[VT102_PRIVATE_MODE_AUTO_REPEAT]=1;
+ v->private_modes[VT102_PRIVATE_MODE_AUTO_WRAP] = 1;
+ v->private_modes[VT102_PRIVATE_MODE_AUTO_REPEAT] = 1;
+ vt102_cursor_home (v);
+ vt102_reset_tabs (v);
+ v->current_line = v->pos;
}
diff --git a/src/vt102.h b/src/vt102.h
index 1007353..1a23dd5 100644
--- a/src/vt102.h
+++ b/src/vt102.h
@@ -12,6 +12,9 @@
/*
* $Log$
+ * Revision 1.5 2008/02/06 15:53:22 james
+ * *** empty log message ***
+ *
* Revision 1.4 2008/02/06 11:30:37 james
* *** empty log message ***
*
@@ -52,10 +55,18 @@ typedef struct
VT102_parser parser;
int attr;
CRT crt;
- CRT_Pos pos;
+
+ int pending_wrap;
+ CRT_Pos pos,current_line;
+
+
+
uint8_t modes[VT102_NMODES];
uint8_t private_modes[VT102_NMODES];
+
+ uint8_t tabs[VT102_COLS];
+
} VT102;
#define VT102_PRIVATE_MODE_CURSOR_MODE 1