/[LeafOK_CVS]/lbbs/src/screen.c
ViewVC logotype

Diff of /lbbs/src/screen.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.109 by sysadm, Tue Oct 14 05:28:15 2025 UTC Revision 1.112 by sysadm, Fri Oct 17 10:57:43 2025 UTC
# Line 104  void clearscr() Line 104  void clearscr()
104    
105  int press_any_key()  int press_any_key()
106  {  {
107            int ch = 0;
108            int wait_seconds = 60;
109            int duration = 0;
110            time_t t_begin = time(NULL);
111    
112          moveto(SCREEN_ROWS, 0);          moveto(SCREEN_ROWS, 0);
113          clrtoeol();          clrtoeol();
114    
115          prints("                           \033[1;33m按任意键继续...\033[0;37m");          prints("                           \033[1;33m按任意键继续...\033[0;37m");
116          iflush();          iflush();
117    
118          return igetch_t(MIN(MAX_DELAY_TIME, 60));          do
119            {
120                    ch = igetch_t(wait_seconds - duration);
121                    duration = (int)(time(NULL) - t_begin);
122            } while (!SYS_server_exit && ch == 0 && duration < 60);
123    
124            return ch;
125  }  }
126    
127  void set_input_echo(int echo)  void set_input_echo(int echo)
# Line 118  void set_input_echo(int echo) Line 129  void set_input_echo(int echo)
129          if (echo)          if (echo)
130          {          {
131                  outc('\x83'); // ASCII code 131                  outc('\x83'); // ASCII code 131
                 iflush();  
132          }          }
133          else          else
134          {          {
135                  //    outc ('\x85'); // ASCII code 133                  // outc ('\x85'); // ASCII code 133
136                  prints("\xff\xfb\x01\xff\xfb\x03");                  prints("\xff\xfb\x01\xff\xfb\x03");
                 iflush();  
                 igetch(0);  
                 igetch_reset();  
137          }          }
138            iflush();
139  }  }
140    
141  static int _str_input(char *buffer, int buf_size, int max_display_len, int echo_mode)  static int _str_input(char *buffer, int buf_size, int max_display_len, int echo_mode)
# Line 151  static int _str_input(char *buffer, int Line 159  static int _str_input(char *buffer, int
159    
160                  if (ch == CR)                  if (ch == CR)
161                  {                  {
                         igetch_reset();  
162                          break;                          break;
163                  }                  }
164                  else if (ch == KEY_TIMEOUT || ch == KEY_NULL) // timeout or broken pipe                  else if (ch == KEY_TIMEOUT || ch == KEY_NULL) // timeout or broken pipe
# Line 322  int get_data(int row, int col, char *pro Line 329  int get_data(int row, int col, char *pro
329    
330                  if (ch == CR)                  if (ch == CR)
331                  {                  {
                         igetch_reset();  
332                          break;                          break;
333                  }                  }
334                  else if (ch == KEY_TIMEOUT || ch == KEY_NULL) // timeout or broken pipe                  else if (ch == KEY_TIMEOUT || ch == KEY_NULL) // timeout or broken pipe
# Line 653  int display_data(const void *p_data, lon Line 659  int display_data(const void *p_data, lon
659                                  ch = igetch_t(MAX_DELAY_TIME);                                  ch = igetch_t(MAX_DELAY_TIME);
660                                  input_ok = 1;                                  input_ok = 1;
661    
662                                    if (ch != KEY_NULL && ch != KEY_TIMEOUT)
663                                    {
664                                            BBS_last_access_tm = time(NULL);
665                                    }
666    
667                                  // extended key handler                                  // extended key handler
668                                  if (key_handler(&ch, &ctx) != 0)                                  if (key_handler(&ch, &ctx) != 0)
669                                  {                                  {
# Line 662  int display_data(const void *p_data, lon Line 673  int display_data(const void *p_data, lon
673                                  switch (ch)                                  switch (ch)
674                                  {                                  {
675                                  case KEY_NULL:                                  case KEY_NULL:
676                                            log_error("KEY_NULL\n");
677                                            goto cleanup;
678                                  case KEY_TIMEOUT:                                  case KEY_TIMEOUT:
679                                            log_error("User input timeout\n");
680                                          goto cleanup;                                          goto cleanup;
681                                  case KEY_HOME:                                  case KEY_HOME:
682                                          if (line_current - output_current_row < 0) // Reach begin                                          if (line_current - output_current_row < 0) // Reach begin
# Line 696  int display_data(const void *p_data, lon Line 710  int display_data(const void *p_data, lon
710                                          output_end_row = SCREEN_ROWS - 1; // Legacy Fterm only works with this line                                          output_end_row = SCREEN_ROWS - 1; // Legacy Fterm only works with this line
711                                          break;                                          break;
712                                  case CR:                                  case CR:
                                         igetch_reset();  
713                                  case KEY_SPACE:                                  case KEY_SPACE:
714                                  case KEY_DOWN:                                  case KEY_DOWN:
715                                          if (line_current + (screen_row_total - (output_current_row - screen_begin_row)) >= display_line_total) // Reach end                                          if (line_current + (screen_row_total - (output_current_row - screen_begin_row)) >= display_line_total) // Reach end
# Line 765  int display_data(const void *p_data, lon Line 778  int display_data(const void *p_data, lon
778                                          input_ok = 0;                                          input_ok = 0;
779                                          break;                                          break;
780                                  }                                  }
   
                                 BBS_last_access_tm = time(NULL);  
781                          }                          }
782    
783                          continue;                          continue;


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1