mirror of
https://github.com/vivier/EMILE.git
synced 2024-12-21 18:30:20 +00:00
use wait_char to wait escape sequence
This commit is contained in:
parent
b82dc3e69f
commit
e193e79a69
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user