replace getchar() by console_getchar()

This commit is contained in:
Laurent Vivier 2007-08-15 19:56:41 +00:00
parent 8d02f4dac4
commit c00938b25e
2 changed files with 10 additions and 3 deletions

View File

@ -27,6 +27,8 @@ extern void console_video_inverse(void);
extern void console_video_normal(void); extern void console_video_normal(void);
extern void console_select_charset(char c); extern void console_select_charset(char c);
extern void console_cursor_off(); extern void console_cursor_off();
extern int console_getchar(void);
extern int console_keypressed(int timeout);
extern void emile_window(emile_window_t *win); extern void emile_window(emile_window_t *win);
extern emile_progressbar_t* emile_progressbar_create(emile_window_t *win, int max); extern emile_progressbar_t* emile_progressbar_create(emile_window_t *win, int max);

View File

@ -47,14 +47,17 @@ int emile_scrolllist(emile_window_t *win, emile_list_t *list)
emile_window(win); emile_window(win);
display_list(win, list, base); display_list(win, list, base);
while((c = getchar()) != -1) while(1)
{ {
c = console_getchar();
if (c == -1)
break;
if (c == '\033') if (c == '\033')
{ {
c = getchar(); c = console_getchar();
if (c != '[') if (c != '[')
continue; continue;
c = getchar(); c = console_getchar();
if ( (c == 'B') && (list->current < list->nb - 1) ) if ( (c == 'B') && (list->current < list->nb - 1) )
{ {
list->current++; list->current++;
@ -72,6 +75,8 @@ int emile_scrolllist(emile_window_t *win, emile_list_t *list)
} }
else else
break; break;
console_keypressed(0);
} }
return c; return c;
} }