--- lbbs/src/screen.c 2005/03/20 17:37:14 1.11 +++ lbbs/src/screen.c 2006/01/03 12:34:54 1.20 @@ -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,22 +101,25 @@ 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); } } int -str_input (char *buffer, int buffer_length, int echo_mode) +_str_input (char *buffer, int buffer_length, int echo_mode) { char buf[256], ch; int c, offset = 0, len, loop = 1, i, hz = 0; - memset (buffer, '\0', buffer_length); + for (i=0; i= screen_lines) + if (line >= max_lines) { f_offset = ftell (fin); @@ -233,7 +270,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) { @@ -266,7 +303,7 @@ display_file_ex (const char *filename, i case KEY_PGUP: case Ctrl ('B'): if (c_line_begin > 0) - c_line_begin -= (screen_lines - begin_line - 1); + c_line_begin -= (max_lines - begin_line - 1); else goto exit; if (c_line_begin < 0) @@ -279,14 +316,14 @@ 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); - if (c_line_begin + (screen_lines - begin_line) > + c_line_begin += (max_lines - begin_line - 1); + if (c_line_begin + (max_lines - begin_line) > c_line_total) c_line_begin = - c_line_total - (screen_lines - begin_line); + c_line_total - (max_lines - begin_line); rewind (fin); for (f_line = 0; f_line < c_line_begin; f_line++) { @@ -294,6 +331,8 @@ display_file_ex (const char *filename, i goto exit; } break; + case KEY_NULL: + case KEY_TIMEOUT: case KEY_LEFT: case 'q': case 'Q':