dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] pnet/support console.c,1.4,1.5


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnet/support console.c,1.4,1.5
Date: Sat, 08 Nov 2003 01:15:58 +0000

Update of /cvsroot/dotgnu-pnet/pnet/support
In directory subversions:/tmp/cvs-serv26961/support

Modified Files:
        console.c 
Log Message:


Recognise metacharacter sequences like ESC-A and convert them into ALT-A.


Index: console.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/console.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** console.c   8 Nov 2003 00:20:41 -0000       1.4
--- console.c   8 Nov 2003 01:15:56 -0000       1.5
***************
*** 351,365 ****
        {"\033OS",              Key_F4,                         0},
        {"\033OZ",              Key_Tab,                        Mod_Shift},
-       {"\033A",               Key_UpArrow,            0},
-       {"\033B",               Key_DownArrow,          0},
-       {"\033C",               Key_RightArrow,         0},
-       {"\033D",               Key_LeftArrow,          0},
-       {"\033H",               Key_Home,                       0},
-       {"\033F",               Key_End,                        0},
-       {"\033P",               Key_F1,                         0},
-       {"\033Q",               Key_F2,                         0},
-       {"\033R",               Key_F3,                         0},
-       {"\033S",               Key_F4,                         0},
-       {"\033Z",               Key_Tab,                        Mod_Shift},
  
        /* Other common keycodes, typical to the "linux" and "xterm" entries */
--- 351,354 ----
***************
*** 1001,1004 ****
--- 990,998 ----
                                        }
                                }
+                               if(!prefixMatch && keyBufferLen >= 2 && 
keyBuffer[0] == '\033')
+                               {
+                                       /* This is probably a meta-character 
indication */
+                                       goto meta;
+                               }
                                if(!prefixMatch || keyBufferLen >= 
KEY_BUFFER_SIZE)
                                {
***************
*** 1017,1020 ****
--- 1011,1032 ----
                        /* Some kind of error occurred */
                        break;
+               }
+               else if(keyBufferLen >= 2 && keyBuffer[0] == '\033')
+               {
+                       /* We got a timeout with at least two characters in the
+                          lookahead buffer where the first is an Escape 
character.
+                          This is probably a metacharacter indication.  e.g. 
ESC-A
+                          is the same as ALT-A */
+               meta:
+                       c = (((int)(keyBuffer[1])) & 0xFF);
+                       keyBufferLen -= 2;
+                       if(keyBufferLen > 0)
+                       {
+                               ILMemMove(keyBuffer, keyBuffer + 2, 
keyBufferLen);
+                       }
+                       *ch = 0;
+                       MapCharToKey(c, key, modifiers);
+                       *modifiers |= Mod_Alt;
+                       return;
                }
                else if(keyBufferLen > 0)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]