use wait_char to wait escape sequence

This commit is contained in:
Laurent Vivier 2007-09-16 15:29:11 +00:00
parent b82dc3e69f
commit e193e79a69
2 changed files with 12 additions and 2 deletions

View File

@ -29,6 +29,7 @@ extern void console_select_charset(char c);
extern void console_cursor_off();
extern int console_getchar(void);
extern int console_keypressed(int timeout);
extern int wait_char;
extern void emile_window(emile_window_t *win);
extern emile_progressbar_t* emile_progressbar_create(emile_window_t *win, int max);

View File

@ -42,6 +42,7 @@ int emile_scrolllist(emile_window_t *win, emile_list_t *list, int timeout)
{
char c;
int base = 0;
int saved_wait = wait_char;
console_cursor_off();
emile_window(win);
@ -50,16 +51,23 @@ int emile_scrolllist(emile_window_t *win, emile_list_t *list, int timeout)
if (timeout && !console_keypressed(timeout * 60))
return '\r';
wait_char = 1;
while(1)
{
console_keypressed(0);
c = console_getchar();
if (c == -1)
break;
if (c == 0)
continue;
if (c == '\033')
{
c = console_getchar();
if (c != '[')
return '\033';
{
c = '\033';
goto out;
}
c = console_getchar();
if ( (c == 'B') && (list->current < list->nb - 1) )
{
@ -78,8 +86,9 @@ int emile_scrolllist(emile_window_t *win, emile_list_t *list, int timeout)
}
else
break;
console_keypressed(0);
}
out:
wait_char = saved_wait;
return c;
}