ref: 7986722cec798e96443096112580b4ab446fefa8
parent: 6261dcb06b11c2db815b2e259b25b18a9673d900
parent: c029a0c9130b7a9b5a9c3883e813dd8d8a0a770d
author: spew <devnull@localhost>
date: Sat Apr 22 10:28:34 EDT 2017
merge
--- a/sys/src/cmd/vt/cons.h
+++ b/sys/src/cmd/vt/cons.h
@@ -40,7 +40,7 @@
char *sequence;
};
extern struct funckey *fk, *appfk;
-extern struct funckey ansifk[], ansiappfk[], xtermfk[];
+extern struct funckey ansifk[], ansiappfk[], vt220fk[];
extern int x, y, xmax, ymax, olines;
extern int peekc, attribute;
--- a/sys/src/cmd/vt/main.c
+++ b/sys/src/cmd/vt/main.c
@@ -219,6 +219,7 @@
attr = defattr;
ARGBEGIN{
case '2':
+ fk = vt220fk;
term = "vt220";
break;
case 'a':
@@ -240,7 +241,7 @@
sysfatal("could not create log file: %s: %r", p);
break;
case 'x':
- fk = xtermfk;
+ fk = vt220fk;
term = "xterm";
break;
case 'r':
@@ -531,14 +532,17 @@
return nil;
}
-void
+int
sendfk(char *name)
{
char *s = lookfk(appfk != nil ? appfk : fk, name);
if(s == nil && appfk != nil)
s = lookfk(fk, name);
- if(s != nil)
+ if(s != nil){
sendnchars(strlen(s), s);
+ return 1;
+ }
+ return 0;
}
int
@@ -570,6 +574,30 @@
resize_flag = 1;
if(cs->raw) {
switch(kbdchar){
+ case Kins:
+ if(!sendfk("insert"))
+ goto Send;
+ break;
+ case Kdel:
+ if(!sendfk("delete"))
+ goto Send;
+ break;
+ case Khome:
+ if(!sendfk("home"))
+ goto Send;
+ break;
+ case Kend:
+ if(!sendfk("end"))
+ goto Send;
+ break;
+
+ case Kpgup:
+ sendfk("page up");
+ break;
+ case Kpgdown:
+ sendfk("page down");
+ break;
+
case Kup:
sendfk("up key");
break;
@@ -582,12 +610,7 @@
case Kright:
sendfk("right key");
break;
- case Kpgup:
- sendfk("page up");
- break;
- case Kpgdown:
- sendfk("page down");
- break;
+
case KF|1:
sendfk("F1");
break;
@@ -624,6 +647,7 @@
case KF|12:
sendfk("F12");
break;
+
case '\n':
echobuf[0] = '\r';
sendnchars(1, echobuf);
@@ -633,6 +657,7 @@
sendnchars(1, echobuf);
break;
default:
+ Send:
sendnchars(runetochar(echobuf, &kbdchar), echobuf);
break;
}
--- a/sys/src/cmd/vt/vt.c
+++ b/sys/src/cmd/vt/vt.c
@@ -57,16 +57,23 @@
{ "down key", "\033OB", },
{ "left key", "\033OD", },
{ "right key", "\033OC", },
+
{ 0 },
};
-struct funckey xtermfk[] = {
+struct funckey vt220fk[] = {
+ { "insert", "\033[2~", },
+ { "delete", "\033[3~", },
+ { "home", "\033[1~", },
+ { "end", "\033[4~", },
{ "page up", "\033[5~", },
{ "page down", "\033[6~", },
+
{ "up key", "\033[A", },
{ "down key", "\033[B", },
{ "left key", "\033[D", },
{ "right key", "\033[C", },
+
{ "F1", "\033OP", },
{ "F2", "\033OQ", },
{ "F3", "\033OR", },
@@ -79,6 +86,7 @@
{ "F10", "\033[21~", },
{ "F11", "\033[23~", },
{ "F12", "\033[24~", },
+
{ 0 },
};