--- lbbs/src/editor.c 2025/06/27 12:54:31 1.33 +++ lbbs/src/editor.c 2025/07/01 08:31:11 1.37 @@ -274,7 +274,7 @@ int editor_data_insert(EDITOR_DATA *p_ed } // Split current data line if over-length - if (len_data_line + str_len + 1 > MAX_EDITOR_DATA_LINE_LENGTH || str[0] == CR) + if (len_data_line + str_len + 2 > MAX_EDITOR_DATA_LINE_LENGTH || str[0] == CR) { if (p_editor_data->display_line_total >= MAX_EDITOR_DATA_LINES) { @@ -294,7 +294,7 @@ int editor_data_insert(EDITOR_DATA *p_ed return -2; } - if (offset_data_line + str_len + 1 >= MAX_EDITOR_DATA_LINE_LENGTH || str[0] == CR) + if (offset_data_line + str_len + 2 >= MAX_EDITOR_DATA_LINE_LENGTH || str[0] == CR) { if (str[0] == CR) { @@ -675,8 +675,7 @@ int editor_display(EDITOR_DATA *p_editor return ch; } - loop = 1; - while (!SYS_server_exit && loop) + for (loop = 1; !SYS_server_exit && loop;) { if (line_current >= p_editor_data->display_line_total || output_current_row > output_end_row) { @@ -772,7 +771,8 @@ int editor_display(EDITOR_DATA *p_editor clrtoeol(); for (i = 0; i < scroll_rows; i++) { - prints("\033[S"); // Scroll up 1 line + // prints("\033[S"); // Scroll up 1 line + prints("\n"); // Legacy Cterm only works with this line } output_current_row -= scroll_rows; @@ -812,8 +812,7 @@ int editor_display(EDITOR_DATA *p_editor { if (line_current - output_current_row + row_pos <= 0 && col_pos <= 1) // Forbidden { - ch = igetch_t(MAX_DELAY_TIME); - continue; + break; // force output prior operation result if any } col_pos--; @@ -1028,7 +1027,8 @@ int editor_display(EDITOR_DATA *p_editor col_pos = MIN(col_pos, MAX(1, p_editor_data->display_line_lengths[line_current - output_current_row + row_pos])); moveto(SCREEN_ROWS, 0); clrtoeol(); - prints("\033[S"); // Scroll up 1 line + // prints("\033[S"); // Scroll up 1 line + prints("\n"); // Legacy Cterm only works with this line break; case KEY_PGUP: if (line_current - output_current_row < 0) // Reach begin