Allow forwards though input history

This commit is contained in:
James Booth
2012-02-27 00:48:55 +00:00
parent 2379ae895f
commit 8f48685930
3 changed files with 36 additions and 8 deletions

View File

@@ -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 &&