]> pd.if.org Git - pd_readline/blob - pd_readline.c
c92870a1e5e60ce6dde18a642e3cee88aa0dc159
[pd_readline] / pd_readline.c
1
2
3 /*  pd_readline.c                                      */  
4 /*  Some code to allow the editing of a command-line.  */ 
5 /*  You can also move around with the left and right   */ 
6 /*  arrow keys, and recall previous commands with the  */ 
7 /*  up-arrow key.                                      */ 
8 /*  This code is released to the public domain.        */ 
9 /*  "Share and enjoy...."  ;)                          */  
10 /*  See the UNLICENSE file for details.                */ 
11
12 /*  TO DO -                                            */ 
13 /*  a) Add support for Home and End (of line) keys.    */ 
14 /*  b) Add support for function keys.                  */ 
15 /*  c) Add support for Insert key so that text can be  */ 
16 /*     inserted.                                       */   
17 /*  d) Put much of the code into a header file.        */    
18 /*  e) Change so that pressing Enter adds the current  */  
19 /*     line of commands to the command-history.        */ 
20 /*     ( May look at using Ctrl-D to exit, as Python   */ 
21 /*     does with its command-line. )                   */           
22 /*  f) Add support for copying and pasting text via    */ 
23 /*     Ctrl-C and Ctrl-V.                              */  
24
25
26 #include "pd_readline.h"    
27
28
29 int main(void) 
30
31   
32   /* Create a buffer for the text.  */ 
33   buf mybuf;  
34   
35   
36   /* Read in the command history file. */ 
37   readhistory("test.txt");  
38   
39   
40   while(1) 
41   {  
42        
43     keyhandler(mybuf);   
44         
45   }         
46                                       
47   return 0;
48         
49 }  
50
51
52
53
54
55