ref: b58584b0578617f6cabcae6e51c6e3e0dc51fec1
parent: 4340dd1b2fbc9eed665dbf8d946aca34ed25be37
parent: 5d7a77cf57a1a3c1b5b1b8203fa9b53dc38561ed
author: cinap_lenrek <[email protected]>
date: Sat Apr 22 14:21:57 EDT 2017
merge
--- a/sys/src/cmd/vt/cons.h
+++ b/sys/src/cmd/vt/cons.h
@@ -54,6 +54,7 @@
extern int get_next_char(void);
extern void ringbell(void);
extern int number(Rune *, int *);
+extern void shift(int,int,int,int);
extern void scroll(int,int,int,int);
extern void backup(int);
extern void sendnchars(int, char *);
--- a/sys/src/cmd/vt/main.c
+++ b/sys/src/cmd/vt/main.c
@@ -214,7 +214,7 @@
fontname = nil;
term = "vt100";
fk = vt100fk;
- blkbg = nocolor = 0;
+ blkbg = 0;
rflag = 0;
attr = defattr;
ARGBEGIN{
@@ -315,8 +315,9 @@
uchar c, *ap, *cp;
Rune *rp;
- /* draw background */
draw(screen, screen->r, bgcolor, nil, ZP);
+
+ /* draw background */
for(y = 0; y <= ymax; y++){
for(x = 0; x <= xmax; x += n){
cp = onscreenc(x, y);
@@ -980,6 +981,18 @@
else if(pt.y > ymax+1)
pt.y = ymax+1;
return pt;
+}
+
+void
+shift(int x1, int y, int x2, int w)
+{
+ if(x1+w > xmax+1)
+ w = xmax+1 - x1;
+ if(x2+w > xmax+1)
+ w = xmax+1 - x2;
+ memmove(onscreenr(x1, y), onscreenr(x2, y), w*sizeof(Rune));
+ memmove(onscreena(x1, y), onscreena(x2, y), w);
+ memmove(onscreenc(x1, y), onscreenc(x2, y), w);
}
void
--- a/sys/src/cmd/vt/vt.c
+++ b/sys/src/cmd/vt/vt.c
@@ -68,10 +68,10 @@
struct funckey xtermfk[NKEYS] = {
{ "page up", "\033[5~", },
{ "page down", "\033[6~", },
- { "up key", "\033[A", },
- { "down key", "\033[B", },
- { "left key", "\033[D", },
- { "right key", "\033[C", },
+ { "up key", "\033OA", },
+ { "down key", "\033OB", },
+ { "left key", "\033OD", },
+ { "right key", "\033OC", },
{ "F1", "\033OP", },
{ "F2", "\033OQ", },
{ "F3", "\033OR", },
@@ -326,7 +326,6 @@
case 'Z':
Ident:
sendnchars(7, "\033[?1;2c"); /* VT100 with AVO option */
-// sendnchars(5, "\033[?6c"); /* VT102 (insert/delete-char, etc.) */
break;
/*
@@ -734,7 +733,7 @@
case 'P':
fixops(operand);
i = x + operand[0];
- draw(screen, Rpt(pt(x, y), pt(xmax+1, y+1)), screen, nil, pt(i, y));
+ shift(x, y, i, xmax+1 - i);
clear(xmax-operand[0], y, xmax+1, y+1);
break;
@@ -744,7 +743,7 @@
case '@':
fixops(operand);
i = x + operand[0];
- draw(screen, Rpt(pt(i, y), pt(xmax+1, y+1)), screen, nil, pt(x, y));
+ shift(i, y, x, xmax+1 - i);
clear(x, y, i, y+1);
break;