From c00938b25ee48c14f7ff963dfc56935ea7b80b76 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Wed, 15 Aug 2007 19:56:41 +0000 Subject: [PATCH] replace getchar() by console_getchar() --- libui/libui.h | 2 ++ libui/scrolllist.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/libui/libui.h b/libui/libui.h index c4a2304..6b93400 100644 --- a/libui/libui.h +++ b/libui/libui.h @@ -27,6 +27,8 @@ extern void console_video_inverse(void); extern void console_video_normal(void); extern void console_select_charset(char c); 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 emile_progressbar_t* emile_progressbar_create(emile_window_t *win, int max); diff --git a/libui/scrolllist.c b/libui/scrolllist.c index 3a365ff..548b67d 100644 --- a/libui/scrolllist.c +++ b/libui/scrolllist.c @@ -47,14 +47,17 @@ int emile_scrolllist(emile_window_t *win, emile_list_t *list) emile_window(win); display_list(win, list, base); - while((c = getchar()) != -1) + while(1) { + c = console_getchar(); + if (c == -1) + break; if (c == '\033') { - c = getchar(); + c = console_getchar(); if (c != '[') continue; - c = getchar(); + c = console_getchar(); if ( (c == 'B') && (list->current < list->nb - 1) ) { list->current++; @@ -72,6 +75,8 @@ int emile_scrolllist(emile_window_t *win, emile_list_t *list) } else break; + console_keypressed(0); } + return c; }