typedef struct {
Glyph attr; /* current char attributes */
- int x;
- int y;
+ int x; /* terminal column */
+ int y; /* terminal row */
char state;
} TCursor;
ttywrite(vtiden, strlen(vtiden), 0);
break;
case 'b': /* REP -- if last char is printable print it <n> more times */
- DEFAULT(csiescseq.arg[0], 1);
+ LIMIT(csiescseq.arg[0], 1, 65535);
if (term.lastc)
while (csiescseq.arg[0]-- > 0)
tputc(term.lastc);
}
break;
case 'S': /* SU -- Scroll <n> line up */
+ if (csiescseq.priv) break;
DEFAULT(csiescseq.arg[0], 1);
tscrollup(term.top, csiescseq.arg[0]);
break;
void
tcontrolcode(uchar ascii)
{
+ size_t i;
+
switch (ascii) {
case '\t': /* HT */
tputtab(1);
return;
case '\b': /* BS */
- tmoveto(term.c.x-1, term.c.y);
+ for (i = 1; term.c.x && term.line[term.c.y][term.c.x - i].u == 0; ++i)
+ ;
+ tmoveto(term.c.x - i, term.c.y);
return;
case '\r': /* CR */
tmoveto(0, term.c.y);
treset();
resettitle();
xloadcols();
+ xsetmode(0, MODE_HIDE);
break;
case '=': /* DECPAM -- Application keypad */
xsetmode(1, MODE_APPKEYPAD);
}
if (term.c.x+width > term.col) {
- tnewline(1);
+ if (IS_SET(MODE_WRAP))
+ tnewline(1);
+ else
+ tmoveto(term.col - width, term.c.y);
gp = &term.line[term.c.y][term.c.x];
}