/[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.57 by sysadm, Sun Nov 9 11:18:07 2025 UTC Revision 1.58 by sysadm, Mon Nov 10 07:23:16 2025 UTC
# Line 23  enum _editor_constant_t Line 23  enum _editor_constant_t
23  {  {
24          EDITOR_MEM_POOL_LINE_PER_CHUNK = 1000,          EDITOR_MEM_POOL_LINE_PER_CHUNK = 1000,
25          EDITOR_MEM_POOL_CHUNK_LIMIT = (MAX_EDITOR_DATA_LINES / EDITOR_MEM_POOL_LINE_PER_CHUNK + 1),          EDITOR_MEM_POOL_CHUNK_LIMIT = (MAX_EDITOR_DATA_LINES / EDITOR_MEM_POOL_LINE_PER_CHUNK + 1),
26            TAB_SIZE = 4,
27  };  };
28    
29  static const char EDITOR_ESC_DISPLAY_STR[] = "\033[32m*\033[m";  static const char EDITOR_ESC_DISPLAY_STR[] = "\033[32m*\033[m";
# Line 679  int editor_display(EDITOR_DATA *p_editor Line 680  int editor_display(EDITOR_DATA *p_editor
680          int i, j;          int i, j;
681          char *p_str;          char *p_str;
682          int del_line;          int del_line;
683            int tab_width = 0;
684    
685          clrline(output_current_row, SCREEN_ROWS);          clrline(output_current_row, SCREEN_ROWS);
686    
# Line 717  int editor_display(EDITOR_DATA *p_editor Line 719  int editor_display(EDITOR_DATA *p_editor
719                          moveto((int)row_pos, (int)col_pos);                          moveto((int)row_pos, (int)col_pos);
720                          iflush();                          iflush();
721    
722                            tab_width = 0;
723                          str_len = 0;                          str_len = 0;
724                          ch = igetch_t(BBS_max_user_idle_time);                          ch = igetch_t(BBS_max_user_idle_time);
725                          while (!SYS_server_exit)                          while (!SYS_server_exit)
# Line 732  int editor_display(EDITOR_DATA *p_editor Line 735  int editor_display(EDITOR_DATA *p_editor
735                                          goto cleanup;                                          goto cleanup;
736                                  }                                  }
737    
738                                    if (ch == '\t')
739                                    {
740                                            ch = ' ';
741                                            tab_width = TAB_SIZE - ((int)(col_pos - 1) % TAB_SIZE) - 1;
742                                    }
743    
744                                  if (ch < 256 && (ch & 0x80)) // head of multi-byte character                                  if (ch < 256 && (ch & 0x80)) // head of multi-byte character
745                                  {                                  {
746                                          str_len = 0;                                          str_len = 0;
# Line 850  int editor_display(EDITOR_DATA *p_editor Line 859  int editor_display(EDITOR_DATA *p_editor
859                                                  break;                                                  break;
860                                          }                                          }
861    
862                                          ch = igetch(0);                                          if (ch == ' ' && tab_width > 0)
                                         if (ch == KEY_NULL || ch == KEY_TIMEOUT) // Output if no futher input  
863                                          {                                          {
864                                                  break;                                                  tab_width--;
865                                            }
866                                            else
867                                            {
868                                                    ch = igetch(0);
869                                                    if (ch == KEY_NULL || ch == KEY_TIMEOUT) // Output if no futher input
870                                                    {
871                                                            break;
872                                                    }
873                                          }                                          }
874    
875                                          str_len = 0;                                          str_len = 0;


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

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