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

Diff of /lbbs/src/editor.c

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

Revision 1.9 by sysadm, Wed Jun 11 10:44:33 2025 UTC Revision 1.11 by sysadm, Wed Jun 11 11:55:50 2025 UTC
# Line 169  int editor_data_insert(EDITOR_DATA *p_ed Line 169  int editor_data_insert(EDITOR_DATA *p_ed
169          // Get accurate offset of first character of CJK at offset position          // Get accurate offset of first character of CJK at offset position
170          for (i = 0; i < offset; i++)          for (i = 0; i < offset; i++)
171          {          {
172                  if (p_editor_data->p_display_lines[display_line][i] < 0) // GBK                  if (p_editor_data->p_display_lines[display_line][i] < 0 || p_editor_data->p_display_lines[display_line][i] > 127) // GBK
173                  {                  {
174                          i++;                          i++;
175                  }                  }
# Line 368  int editor_data_delete(EDITOR_DATA *p_ed Line 368  int editor_data_delete(EDITOR_DATA *p_ed
368          // Get accurate offset of first character of CJK at offset position          // Get accurate offset of first character of CJK at offset position
369          for (i = 0; i < offset; i++)          for (i = 0; i < offset; i++)
370          {          {
371                  if (p_editor_data->p_display_lines[display_line][i] < 0) // GBK                  if (p_editor_data->p_display_lines[display_line][i] < 0 || p_editor_data->p_display_lines[display_line][i] > 127) // GBK
372                  {                  {
373                          i++;                          i++;
374                  }                  }
# Line 417  int editor_data_delete(EDITOR_DATA *p_ed Line 417  int editor_data_delete(EDITOR_DATA *p_ed
417          }          }
418          else          else
419          {          {
420                  log_error("Some strange character at display_line %ld, offset %ld\n", display_line, offset);                  log_error("Some strange character at display_line %ld, offset %ld: %d %d %d %d\n",
421                  return -2;                                    display_line, offset, p_data_line[offset_data_line], p_data_line[offset_data_line + 1],
422                                      p_data_line[offset_data_line + 2], p_data_line[offset_data_line + 3]);
423                    str_len = 1;
424          }          }
425    
426          // Current display line is (almost) empty          // Current display line is (almost) empty
# Line 586  int editor_display(EDITOR_DATA *p_editor Line 588  int editor_display(EDITOR_DATA *p_editor
588                          iflush();                          iflush();
589    
590                          input_ok = 0;                          input_ok = 0;
591                            ch = igetch_t(MAX_DELAY_TIME);
592                          while (!SYS_server_exit && !input_ok)                          while (!SYS_server_exit && !input_ok)
593                          {                          {
                                 ch = igetch_t(MAX_DELAY_TIME);  
                                 input_ok = 1;  
   
594                                  // extended key handler                                  // extended key handler
595                                  if (editor_display_key_handler(&ch, &ctx) != 0)                                  if (editor_display_key_handler(&ch, &ctx) != 0)
596                                  {                                  {
# Line 668  int editor_display(EDITOR_DATA *p_editor Line 668  int editor_display(EDITOR_DATA *p_editor
668                                                          row_pos += (display_line_out - display_line_in);                                                          row_pos += (display_line_out - display_line_in);
669                                                  }                                                  }
670                                                  col_pos = offset_out + 1;                                                  col_pos = offset_out + 1;
671                                            }
672    
673                                                  continue;                                          // Check whether there is additional input
674                                            ch = igetch(0);
675                                            if (ch == KEY_TIMEOUT)
676                                            {
677                                                    input_ok = 1;
678                                          }                                          }
679                                            continue;
680                                  }                                  }
681                                  else if (ch == KEY_DEL || ch == BACKSPACE) // Del                                  else if (ch == KEY_DEL || ch == BACKSPACE) // Del
682                                  {                                  {
# Line 716  int editor_display(EDITOR_DATA *p_editor Line 722  int editor_display(EDITOR_DATA *p_editor
722                                                  }                                                  }
723                                          }                                          }
724    
725                                            // Check whether there is additional input
726                                            ch = igetch(0);
727                                            if (ch == KEY_TIMEOUT)
728                                            {
729                                                    input_ok = 1;
730                                            }
731                                          continue;                                          continue;
732                                  }                                  }
733    
734                                    input_ok = 1;
735                                  switch (ch)                                  switch (ch)
736                                  {                                  {
737                                  case KEY_NULL:                                  case KEY_NULL:
# Line 881  int editor_display(EDITOR_DATA *p_editor Line 894  int editor_display(EDITOR_DATA *p_editor
894                                  }                                  }
895    
896                                  BBS_last_access_tm = time(0);                                  BBS_last_access_tm = time(0);
897                                    if (!input_ok)
898                                    {
899                                            ch = igetch_t(MAX_DELAY_TIME);
900                                    }
901                          }                          }
902    
903                          continue;                          continue;


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

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