/[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.26 by sysadm, Mon Jun 16 14:30:44 2025 UTC Revision 1.30 by sysadm, Sat Jun 21 01:34:12 2025 UTC
# Line 14  Line 14 
14   *                                                                         *   *                                                                         *
15   ***************************************************************************/   ***************************************************************************/
16    
 #define _POSIX_C_SOURCE 200809L  
   
17  #include "editor.h"  #include "editor.h"
18  #include "bbs.h"  #include "bbs.h"
19  #include "io.h"  #include "io.h"
# Line 24  Line 22 
22  #include "str_process.h"  #include "str_process.h"
23  #include "memory_pool.h"  #include "memory_pool.h"
24  #include <stdlib.h>  #include <stdlib.h>
 #include <sys/param.h>  
 #include <strings.h>  
25  #include <string.h>  #include <string.h>
26    #include <sys/param.h>
27    
28  #define EDITOR_ESC_DISPLAY_STR "\033[32m*\033[m"  #define EDITOR_ESC_DISPLAY_STR "\033[32m*\033[m"
29  #define EDITOR_MEM_POOL_LINE_PER_CHUNK 1000  #define EDITOR_MEM_POOL_LINE_PER_CHUNK 1000
# Line 281  int editor_data_insert(EDITOR_DATA *p_ed Line 278  int editor_data_insert(EDITOR_DATA *p_ed
278          {          {
279                  if (p_editor_data->display_line_total >= MAX_EDITOR_DATA_LINES)                  if (p_editor_data->display_line_total >= MAX_EDITOR_DATA_LINES)
280                  {                  {
281                          // log_error("Split line error, display_line_total(%ld) reach limit(%d)\n",  #ifdef _DEBUG
282                          //                p_editor_data->display_line_total, MAX_EDITOR_DATA_LINES);                          log_error("Split line error, display_line_total(%ld) reach limit(%d)\n",
283                                              p_editor_data->display_line_total, MAX_EDITOR_DATA_LINES);
284    #endif
285    
286                          return -2;                          return -2;
287                  }                  }
288    
# Line 371  int editor_data_insert(EDITOR_DATA *p_ed Line 371  int editor_data_insert(EDITOR_DATA *p_ed
371                          // Insert blank display line after last_display_line                          // Insert blank display line after last_display_line
372                          if (p_editor_data->display_line_total >= MAX_EDITOR_DATA_LINES)                          if (p_editor_data->display_line_total >= MAX_EDITOR_DATA_LINES)
373                          {                          {
374                                  // log_error("display_line_total over limit %d >= %d\n", p_editor_data->display_line_total, MAX_EDITOR_DATA_LINES);  #ifdef _DEBUG
375                                    log_error("display_line_total over limit %d >= %d\n", p_editor_data->display_line_total, MAX_EDITOR_DATA_LINES);
376    #endif
377    
378                                  // Terminate prior display line with \n, to avoid error on cleanup                                  // Terminate prior display line with \n, to avoid error on cleanup
379                                  if (display_line + i - 1 >= 0 && p_editor_data->display_line_lengths[display_line + i - 1] > 0)                                  if (display_line + i - 1 >= 0 && p_editor_data->display_line_lengths[display_line + i - 1] > 0)
380                                  {                                  {
# Line 708  int editor_display(EDITOR_DATA *p_editor Line 711  int editor_display(EDITOR_DATA *p_editor
711                                  if ((ch >= 32 && ch < 127) || (ch > 127 && ch <= 255 && str_len == 2) || // Printable character or GBK                                  if ((ch >= 32 && ch < 127) || (ch > 127 && ch <= 255 && str_len == 2) || // Printable character or GBK
712                                          ch == CR || ch == KEY_ESC)                                                                                       // Special character                                          ch == CR || ch == KEY_ESC)                                                                                       // Special character
713                                  {                                  {
714                                          BBS_last_access_tm = time(0);                                          BBS_last_access_tm = time(NULL);
715    
716                                          if (str_len == 0) // ch >= 32 && ch < 127                                          if (str_len == 0) // ch >= 32 && ch < 127
717                                          {                                          {
# Line 784  int editor_display(EDITOR_DATA *p_editor Line 787  int editor_display(EDITOR_DATA *p_editor
787                                  }                                  }
788                                  else if (ch == KEY_DEL || ch == BACKSPACE) // Del                                  else if (ch == KEY_DEL || ch == BACKSPACE) // Del
789                                  {                                  {
790                                          BBS_last_access_tm = time(0);                                          BBS_last_access_tm = time(NULL);
791    
792                                          if (ch == BACKSPACE)                                          if (ch == BACKSPACE)
793                                          {                                          {
# Line 1061  int editor_display(EDITOR_DATA *p_editor Line 1064  int editor_display(EDITOR_DATA *p_editor
1064                                          break;                                          break;
1065                                  }                                  }
1066    
1067                                  BBS_last_access_tm = time(0);                                  BBS_last_access_tm = time(NULL);
1068    
1069                                  if (input_ok)                                  if (input_ok)
1070                                  {                                  {


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

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