about summary refs log tree commit diff stats
path: root/input_win.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-02-27 00:48:55 +0000
committerJames Booth <boothj5@gmail.com>2012-02-27 00:48:55 +0000
commit8f4868593099d852d320c63f8546bd5af44c6023 (patch)
treecf0f95a0cb0bfc5f5a4332bfcba19356daffc6ab /input_win.c
parent2379ae895f77b859da2adc1fb733529b66b33a76 (diff)
downloadprofani-tty-8f4868593099d852d320c63f8546bd5af44c6023.tar.gz
Allow forwards though input history
Diffstat (limited to 'input_win.c')
-rw-r--r--input_win.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/input_win.c b/input_win.c
index 8becfcc9..91d98caa 100644
--- a/input_win.c
+++ b/input_win.c
@@ -125,7 +125,7 @@ void inp_poll_char(int *ch, char *input, int *size)
 
     // up arrow
     } else if (*ch == KEY_UP) {
-        char *prev = inpbuf_get_previous();
+        char *prev = inpbuf_previous();
         if (prev) {
             strcpy(input, prev);
             *size = strlen(input);
@@ -135,6 +135,18 @@ void inp_poll_char(int *ch, char *input, int *size)
                 waddch(inp_win, input[i]);
         }
 
+    // down arrow
+    } else if (*ch == KEY_DOWN) {
+        char *next = inpbuf_next();
+        if (next) {
+            strcpy(input, next);
+            *size = strlen(input);
+            inp_clear();
+            int i;
+            for (i = 0; i < *size; i++)
+                waddch(inp_win, input[i]);
+        }
+
     // else if not error, newline or special key, 
     // show it and store it
     } else if (*ch != ERR &&