--- lbbs/src/editor.c 2025/06/16 14:30:44 1.26 +++ lbbs/src/editor.c 2025/06/21 02:15:18 1.31 @@ -14,19 +14,16 @@ * * ***************************************************************************/ -#define _POSIX_C_SOURCE 200809L - -#include "editor.h" #include "bbs.h" +#include "common.h" +#include "editor.h" #include "io.h" #include "log.h" -#include "common.h" -#include "str_process.h" #include "memory_pool.h" +#include "str_process.h" #include -#include -#include #include +#include #define EDITOR_ESC_DISPLAY_STR "\033[32m*\033[m" #define EDITOR_MEM_POOL_LINE_PER_CHUNK 1000 @@ -281,8 +278,11 @@ int editor_data_insert(EDITOR_DATA *p_ed { if (p_editor_data->display_line_total >= MAX_EDITOR_DATA_LINES) { - // log_error("Split line error, display_line_total(%ld) reach limit(%d)\n", - // p_editor_data->display_line_total, MAX_EDITOR_DATA_LINES); +#ifdef _DEBUG + log_error("Split line error, display_line_total(%ld) reach limit(%d)\n", + p_editor_data->display_line_total, MAX_EDITOR_DATA_LINES); +#endif + return -2; } @@ -371,7 +371,10 @@ int editor_data_insert(EDITOR_DATA *p_ed // Insert blank display line after last_display_line if (p_editor_data->display_line_total >= MAX_EDITOR_DATA_LINES) { - // log_error("display_line_total over limit %d >= %d\n", p_editor_data->display_line_total, MAX_EDITOR_DATA_LINES); +#ifdef _DEBUG + log_error("display_line_total over limit %d >= %d\n", p_editor_data->display_line_total, MAX_EDITOR_DATA_LINES); +#endif + // Terminate prior display line with \n, to avoid error on cleanup if (display_line + i - 1 >= 0 && p_editor_data->display_line_lengths[display_line + i - 1] > 0) { @@ -708,7 +711,7 @@ int editor_display(EDITOR_DATA *p_editor if ((ch >= 32 && ch < 127) || (ch > 127 && ch <= 255 && str_len == 2) || // Printable character or GBK ch == CR || ch == KEY_ESC) // Special character { - BBS_last_access_tm = time(0); + BBS_last_access_tm = time(NULL); if (str_len == 0) // ch >= 32 && ch < 127 { @@ -784,7 +787,7 @@ int editor_display(EDITOR_DATA *p_editor } else if (ch == KEY_DEL || ch == BACKSPACE) // Del { - BBS_last_access_tm = time(0); + BBS_last_access_tm = time(NULL); if (ch == BACKSPACE) { @@ -1061,7 +1064,7 @@ int editor_display(EDITOR_DATA *p_editor break; } - BBS_last_access_tm = time(0); + BBS_last_access_tm = time(NULL); if (input_ok) {