--- lbbs/src/screen.c 2005/03/20 17:37:14 1.11 +++ lbbs/src/screen.c 2005/05/06 15:48:44 1.16 @@ -62,6 +62,13 @@ clrline (int line_begin, int line_end) } void +clrtobot (int line_begin) +{ + clrline (line_begin, screen_lines); + moveto (line_begin, 0); +} + +void clearscr () { prints ("\33[2J"); @@ -78,14 +85,12 @@ press_any_key () prints (" \033[1;33m°´ÈÎÒâ¼ü¼ÌÐø...\033[0;37m"); iflush (); - return igetch (); + return igetch_t (60); } void set_input_echo (int echo) { - char temp[256]; - if (echo) { outc ('\x83'); // ASCII code 131 @@ -96,8 +101,8 @@ set_input_echo (int echo) // outc ('\x85'); // ASCII code 133 prints ("\xff\xfb\x01\xff\xfb\x03"); iflush (); - igetch (); - igetch (); + igetch_t (60); + igetch_t (60); } } @@ -109,9 +114,9 @@ str_input (char *buffer, int buffer_leng memset (buffer, '\0', buffer_length); - while (c = igetch ()) + while (c = igetch_t (60)) { - if (c == CR) + if (c == KEY_NULL || c == KEY_TIMEOUT || c == CR) break; if (c == LF) continue; @@ -163,6 +168,22 @@ str_input (char *buffer, int buffer_leng } int +get_data (int row, int col, char *prompt, char *buffer, int buffer_length, int echo_mode) +{ + int len; + + moveto (row, col); + iflush (); + prints (prompt); + prints (buffer); + iflush (); + + len = str_input (buffer, buffer_length, echo_mode); + + return len; +} + +int display_file (const char *filename) { char buffer[260]; @@ -233,7 +254,7 @@ display_file_ex (const char *filename, i input_ok = 0; while (!input_ok) { - ch = igetch (); + ch = igetch_t (MAX_DELAY_TIME); input_ok = 1; switch (ch) { @@ -279,7 +300,7 @@ display_file_ex (const char *filename, i } break; case KEY_RIGHT: - case KEY_PGDOWN: + case KEY_PGDN: case Ctrl ('F'): case KEY_SPACE: c_line_begin += (screen_lines - begin_line - 1); @@ -294,6 +315,8 @@ display_file_ex (const char *filename, i goto exit; } break; + case KEY_NULL: + case KEY_TIMEOUT: case KEY_LEFT: case 'q': case 'Q':