[Xxvt-commit] CVS: xxvt main.c,1.19,1.20
Status: Pre-Alpha
Brought to you by:
nlevitt
|
From: Pierre-Paul L. <pp...@us...> - 2002-03-31 04:38:57
|
Update of /cvsroot/xxvt/xxvt
In directory usw-pr-cvs1:/tmp/cvs-serv31931
Modified Files:
main.c
Log Message:
make up/down/left/right arrow keys work on a terminal which support ANSI
escape sequences.
Case insensitive comparasion might be use here, I don't know what
the X standard have to say about the standard names returned by
XLookupString
I don't know about the debug levels for xxvt_debug... just put zero.
Index: main.c
===================================================================
RCS file: /cvsroot/xxvt/xxvt/main.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- main.c 25 Mar 2002 02:05:33 -0000 1.19
+++ main.c 31 Mar 2002 04:38:55 -0000 1.20
@@ -107,6 +107,7 @@
size_t len;
static char buf[10];
KeySym ks;
+ char *pch;
const char *const eventnames[] = {
"", "", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease",
@@ -125,6 +126,33 @@
{
case KeyPress:
len = XLookupString(&e.xkey, buf, sizeof(buf), &ks, NULL);
+
+ if (len == 0 && (pch = XKeysymToString(ks)) != NULL)
+ {
+ if (strcmp(pch, "Up") == 0)
+ {
+ memcpy(buf, "\033[A", 4);
+ len = 3;
+ }
+ else if (strcmp(pch, "Down") == 0)
+ {
+ memcpy(buf, "\033[B", 4);
+ len = 3;
+ }
+ else if (strcmp(pch, "Right") == 0)
+ {
+ memcpy(buf, "\033[C", 4);
+ len = 3;
+ }
+ else if (strcmp(pch, "Left") == 0)
+ {
+ memcpy(buf, "\033[D", 4);
+ len = 3;
+ }
+ else
+ xxvt_debug(0, "XKeysymToString: %s\n", pch);
+ }
+
if (write(xxvt->cmd->pty, buf, len) < 0)
perror("write");
break;
|