--- lbbs/src/editor.c 2025/07/20 02:04:21 1.40 +++ lbbs/src/editor.c 2025/10/11 10:36:42 1.45 @@ -19,6 +19,7 @@ #include "editor.h" #include "io.h" #include "log.h" +#include "login.h" #include "memory_pool.h" #include "str_process.h" #include @@ -48,7 +49,7 @@ int editor_memory_pool_init(void) } p_mp_editor_data = memory_pool_init(sizeof(EDITOR_DATA), 1, 1); - if (p_mp_data_line == NULL) + if (p_mp_editor_data == NULL) { log_error("Memory pool init error\n"); return -3; @@ -743,6 +744,12 @@ int editor_display(EDITOR_DATA *p_editor { BBS_last_access_tm = time(NULL); + // Refresh current action while user input + if (user_online_update(NULL) < 0) + { + log_error("user_online_update(NULL) error\n"); + } + if (str_len == 0) // ch >= 32 && ch < 127 { input_str[0] = (char)ch; @@ -807,7 +814,7 @@ int editor_display(EDITOR_DATA *p_editor { col_pos = 1; } - if (ch != CR) + if (offset_out > 0) { col_pos += (str_len == 1 ? 1 : 2); } @@ -832,6 +839,12 @@ int editor_display(EDITOR_DATA *p_editor { BBS_last_access_tm = time(NULL); + // Refresh current action while user input + if (user_online_update(NULL) < 0) + { + log_error("user_online_update(NULL) error\n"); + } + if (ch == BACKSPACE) { if (line_current - output_current_row + row_pos <= 0 && col_pos <= 1) // Forbidden @@ -920,6 +933,7 @@ int editor_display(EDITOR_DATA *p_editor case KEY_TIMEOUT: goto cleanup; case Ctrl('W'): + case Ctrl('X'): loop = 0; break; case Ctrl('S'): // Start of line @@ -1096,6 +1110,7 @@ int editor_display(EDITOR_DATA *p_editor col_pos = MIN(col_pos, MAX(1, p_editor_data->display_line_widths[line_current - output_current_row + row_pos])); clrline(output_current_row, SCREEN_ROWS); break; + case Ctrl('Q'): case KEY_F1: if (!show_help) // Not reentrant { @@ -1121,6 +1136,12 @@ int editor_display(EDITOR_DATA *p_editor BBS_last_access_tm = time(NULL); + // Refresh current action while user input + if (user_online_update(NULL) < 0) + { + log_error("user_online_update(NULL) error\n"); + } + if (input_ok) { break;