changeset 77:e8c9d7d13866

Handle certain key sequences better.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 13 Dec 2008 11:19:19 +0200
parents 162951c382b8
children 745f670068dc
files nnchat.c
diffstat 1 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/nnchat.c	Sun Nov 16 14:02:18 2008 +0200
+++ b/nnchat.c	Sat Dec 13 11:19:19 2008 +0200
@@ -619,7 +619,7 @@
     memset(histBuf, 0, sizeof(histBuf));
     
     /* Initialize */
-    th_init("NNChat", "Newbie Nudes chat client", "0.6.5",
+    th_init("NNChat", "Newbie Nudes chat client", "0.6.6",
         "Written and designed by Anonymous Finnish Guy (C) 2008",
         "This software is freeware, use and distribute as you wish.");
     th_verbosityLevel = 0;
@@ -814,6 +814,24 @@
             /* Handle several buffered keypresses at once */
             do {
             c = wgetch(stdscr);
+            
+            if (c == 0x1b) {
+                c = wgetch(stdscr);
+                if (c == 'O') {
+                    c = wgetch(stdscr);
+                    switch (c) {
+                        case 'd': c = 0x204; break;
+                        case 'c': c = 0x206; break;
+                        default:
+                            printMsg("Unhandled ESC-O key sequence 0x%02x\n", c);
+                            break;
+                    }
+                } else {
+                    printMsg("Unhandled ESC key sequence 0x%02x\n", c);
+                    continue;
+                }
+            }
+            
             switch (c) {
 #ifdef KEY_RESIZE
             case KEY_RESIZE:
@@ -957,7 +975,7 @@
                     setBufPos(editBuf, editBuf->pos + 1);
                     update = TRUE; 
                 } else {
-                    printMsg("Unhandled key: %02x\n", c);
+                    printMsg("Unhandled key: 0x%02x\n", c);
                 }
                 break;
             }