From a2ded27fbbe1d152bcc1927e6decff86e2c940a7 Mon Sep 17 00:00:00 2001 From: andy Date: Sat, 27 Oct 2012 23:30:26 +1300 Subject: [PATCH] More work. --- funcs.c | 11 ++++++++--- keyhandler.c | 2 +- pd_readline.h | 5 +++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/funcs.c b/funcs.c index f298d7a..8ac14c6 100644 --- a/funcs.c +++ b/funcs.c @@ -103,11 +103,16 @@ int type(int i) /* Function for special key combinations */ /* (Ctrl, Alt, function keys. */ -int spec(int i) +void spec(void) { - - + int j = getch(); + + if ( ( j == 65 ) ) printf("Up "); + else if ( ( j == 66 ) ) printf("Down "); + else if ( ( j == 67 ) ) printf("Right "); + else if ( ( j == 68 ) ) printf("Left "); + } diff --git a/keyhandler.c b/keyhandler.c index 2fc6ee5..9636491 100644 --- a/keyhandler.c +++ b/keyhandler.c @@ -82,7 +82,7 @@ void keyhandler(buf b) case (1): break; /* Ctrl a */ case (2): break; /* Ctrl b */ - case (3): break; /* Ctrl c */ + case (3): getch(); spec(); break; /* Ctrl c */ case (4): printf("%c", i); break; /* Printable chars. */ case (5): delch(b); break; case (6): break; diff --git a/pd_readline.h b/pd_readline.h index 67f844c..a79e7a6 100644 --- a/pd_readline.h +++ b/pd_readline.h @@ -27,8 +27,9 @@ int range(int rstart, int rend, int i); int type(int i); -/* Escape-key handling. */ -int spec(int i); +/* Special key handling. */ +void spec(void); + /* Other funcs. */ void readhistory(char *fname); -- 2.40.0