| 14 |
* * |
* * |
| 15 |
***************************************************************************/ |
***************************************************************************/ |
| 16 |
|
|
|
#include "editor.h" |
|
| 17 |
#include "bbs.h" |
#include "bbs.h" |
| 18 |
|
#include "common.h" |
| 19 |
|
#include "editor.h" |
| 20 |
#include "io.h" |
#include "io.h" |
| 21 |
#include "log.h" |
#include "log.h" |
|
#include "common.h" |
|
|
#include "str_process.h" |
|
| 22 |
#include "memory_pool.h" |
#include "memory_pool.h" |
| 23 |
|
#include "str_process.h" |
| 24 |
#include <stdlib.h> |
#include <stdlib.h> |
|
#include <sys/param.h> |
|
|
#include <strings.h> |
|
|
|
|
|
#define _POSIX_C_SOURCE 200809L |
|
| 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 |
| 76 |
{ |
{ |
| 77 |
EDITOR_DATA *p_editor_data; |
EDITOR_DATA *p_editor_data; |
| 78 |
char *p_data_line = NULL; |
char *p_data_line = NULL; |
| 79 |
long line_offsets[MAX_EDITOR_DATA_LINES]; |
long line_offsets[MAX_EDITOR_DATA_LINES + 1]; |
| 80 |
long current_data_line_length = 0; |
long current_data_line_length = 0; |
| 81 |
long i; |
long i; |
| 82 |
|
|
| 93 |
return NULL; |
return NULL; |
| 94 |
} |
} |
| 95 |
|
|
| 96 |
p_editor_data->display_line_total = split_data_lines(p_data, SCREEN_COLS, line_offsets, MAX_EDITOR_DATA_LINES); |
p_editor_data->display_line_total = split_data_lines(p_data, SCREEN_COLS, line_offsets, MAX_EDITOR_DATA_LINES + 1, 0); |
| 97 |
|
|
| 98 |
for (i = 0; i < p_editor_data->display_line_total; i++) |
for (i = 0; i < p_editor_data->display_line_total; i++) |
| 99 |
{ |
{ |
| 125 |
current_data_line_length += p_editor_data->display_line_lengths[i]; |
current_data_line_length += p_editor_data->display_line_lengths[i]; |
| 126 |
|
|
| 127 |
// Trim \n from last line |
// Trim \n from last line |
| 128 |
if (i + 1 == p_editor_data->display_line_total && |
if (i + 1 == p_editor_data->display_line_total && |
| 129 |
p_editor_data->display_line_lengths[i] > 0 && |
p_editor_data->display_line_lengths[i] > 0 && |
| 130 |
p_editor_data->p_display_lines[i][p_editor_data->display_line_lengths[i] - 1] == '\n') |
p_editor_data->p_display_lines[i][p_editor_data->display_line_lengths[i] - 1] == '\n') |
| 131 |
{ |
{ |
| 132 |
p_editor_data->display_line_lengths[i]--; |
p_editor_data->display_line_lengths[i]--; |
| 135 |
p_data_line[current_data_line_length] = '\0'; |
p_data_line[current_data_line_length] = '\0'; |
| 136 |
} |
} |
| 137 |
|
|
| 138 |
bzero(p_editor_data->p_display_lines + p_editor_data->display_line_total, MAX_EDITOR_DATA_LINES - (size_t)p_editor_data->display_line_total); |
memset(p_editor_data->p_display_lines + p_editor_data->display_line_total, 0, MAX_EDITOR_DATA_LINES - (size_t)p_editor_data->display_line_total); |
| 139 |
|
|
| 140 |
return p_editor_data; |
return p_editor_data; |
| 141 |
} |
} |
| 224 |
return -1; |
return -1; |
| 225 |
} |
} |
| 226 |
|
|
| 227 |
|
// Validate str |
| 228 |
|
if ((str_len == 1 && str[0] <= 0) || |
| 229 |
|
(str_len == 2 && (str[0] >= 0 || str[1] >= 0))) |
| 230 |
|
{ |
| 231 |
|
log_error("Invalid input str, len=%d\n", str_len); |
| 232 |
|
return -2; |
| 233 |
|
} |
| 234 |
|
|
| 235 |
// Get accurate offset of first character of CJK at offset position |
// Get accurate offset of first character of CJK at offset position |
| 236 |
for (i = 0; i < offset; i++) |
for (i = 0; i < offset; i++) |
| 237 |
{ |
{ |
| 238 |
if (p_editor_data->p_display_lines[display_line][i] < 0 || p_editor_data->p_display_lines[display_line][i] > 127) // GBK |
if (p_editor_data->p_display_lines[display_line][i] < 0) // GBK |
| 239 |
{ |
{ |
| 240 |
i++; |
i++; |
| 241 |
} |
} |
| 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 |
|
|
| 362 |
} |
} |
| 363 |
|
|
| 364 |
// Split current data line since beginning of current display line |
// Split current data line since beginning of current display line |
| 365 |
split_line_total = split_data_lines(p_data_line, SCREEN_COLS, line_offsets, split_line_total); |
split_line_total = split_data_lines(p_data_line, SCREEN_COLS, line_offsets, split_line_total, 0); |
| 366 |
|
|
| 367 |
for (i = 0; i < split_line_total; i++) |
for (i = 0; i < split_line_total; i++) |
| 368 |
{ |
{ |
| 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 |
{ |
{ |
| 381 |
len = split_line(p_editor_data->p_display_lines[display_line + i - 1], SCREEN_COLS - 1, &eol, &display_len); |
len = split_line(p_editor_data->p_display_lines[display_line + i - 1], SCREEN_COLS - 1, &eol, &display_len, 0); |
| 382 |
p_editor_data->p_display_lines[display_line + i - 1][len] = '\n'; |
p_editor_data->p_display_lines[display_line + i - 1][len] = '\n'; |
| 383 |
p_editor_data->p_display_lines[display_line + i - 1][len + 1] = '\0'; |
p_editor_data->p_display_lines[display_line + i - 1][len + 1] = '\0'; |
| 384 |
p_editor_data->display_line_lengths[display_line + i - 1] = len + 1; |
p_editor_data->display_line_lengths[display_line + i - 1] = len + 1; |
| 422 |
} |
} |
| 423 |
} |
} |
| 424 |
|
|
| 425 |
|
// Prevent the last display line from being over-length |
| 426 |
|
if (p_editor_data->display_line_total == MAX_EDITOR_DATA_LINES) |
| 427 |
|
{ |
| 428 |
|
len = split_line(p_editor_data->p_display_lines[p_editor_data->display_line_total - 1], SCREEN_COLS - 1, &eol, &display_len, 0); |
| 429 |
|
p_editor_data->p_display_lines[p_editor_data->display_line_total - 1][len] = '\0'; |
| 430 |
|
p_editor_data->display_line_lengths[p_editor_data->display_line_total - 1] = len; |
| 431 |
|
if (*p_display_line + 1 >= p_editor_data->display_line_total) |
| 432 |
|
{ |
| 433 |
|
*p_offset = MIN(*p_offset, len); |
| 434 |
|
*p_display_line = p_editor_data->display_line_total - 1; |
| 435 |
|
} |
| 436 |
|
} |
| 437 |
|
|
| 438 |
return 0; |
return 0; |
| 439 |
} |
} |
| 440 |
|
|
| 441 |
int editor_data_delete(EDITOR_DATA *p_editor_data, long display_line, long offset, |
int editor_data_delete(EDITOR_DATA *p_editor_data, long *p_display_line, long *p_offset, |
| 442 |
long *p_last_updated_line) |
long *p_last_updated_line) |
| 443 |
{ |
{ |
| 444 |
|
long display_line = *p_display_line; |
| 445 |
|
long offset = *p_offset; |
| 446 |
char *p_data_line = NULL; |
char *p_data_line = NULL; |
| 447 |
long len_data_line; |
long len_data_line; |
| 448 |
long offset_data_line; |
long offset_data_line; |
| 461 |
// Get accurate offset of first character of CJK at offset position |
// Get accurate offset of first character of CJK at offset position |
| 462 |
for (i = 0; i < offset; i++) |
for (i = 0; i < offset; i++) |
| 463 |
{ |
{ |
| 464 |
if (p_editor_data->p_display_lines[display_line][i] < 0 || p_editor_data->p_display_lines[display_line][i] > 127) // GBK |
if (p_editor_data->p_display_lines[display_line][i] < 0) // GBK |
| 465 |
{ |
{ |
| 466 |
i++; |
i++; |
| 467 |
} |
} |
| 509 |
{ |
{ |
| 510 |
str_len = 1; |
str_len = 1; |
| 511 |
} |
} |
| 512 |
else if (p_data_line[offset_data_line + 1] < 0 || p_data_line[offset_data_line] > 127) // GBK |
else if (p_data_line[offset_data_line + 1] < 0) // GBK |
| 513 |
{ |
{ |
| 514 |
str_len = 2; |
str_len = 2; |
| 515 |
} |
} |
| 567 |
split_line_total = last_display_line - display_line + 2; |
split_line_total = last_display_line - display_line + 2; |
| 568 |
|
|
| 569 |
// Split current data line since beginning of current display line |
// Split current data line since beginning of current display line |
| 570 |
split_line_total = split_data_lines(p_data_line, SCREEN_COLS, line_offsets, split_line_total); |
split_line_total = split_data_lines(p_data_line, SCREEN_COLS, line_offsets, split_line_total, 0); |
| 571 |
|
|
| 572 |
for (i = 0; i < split_line_total; i++) |
for (i = 0; i < split_line_total; i++) |
| 573 |
{ |
{ |
| 600 |
*p_last_updated_line = MAX(j - 1, *p_last_updated_line); |
*p_last_updated_line = MAX(j - 1, *p_last_updated_line); |
| 601 |
} |
} |
| 602 |
|
|
| 603 |
|
// Return real offset |
| 604 |
|
*p_offset = offset; |
| 605 |
|
|
| 606 |
return str_len; |
return str_len; |
| 607 |
} |
} |
| 608 |
|
|
| 612 |
{ |
{ |
| 613 |
case 0: // Set msg |
case 0: // Set msg |
| 614 |
snprintf(p_ctx->msg, sizeof(p_ctx->msg), |
snprintf(p_ctx->msg, sizeof(p_ctx->msg), |
| 615 |
"| Í˳ö[\033[32mCtrl-W\033[33m] | °ïÖú[\033[32mh\033[33m] |"); |
"| Í˳ö[\033[32mCtrl-W\033[33m] |"); |
| 616 |
|
break; |
| 617 |
|
case KEY_CSI: |
| 618 |
|
*p_key = KEY_ESC; |
| 619 |
break; |
break; |
| 620 |
} |
} |
| 621 |
|
|
| 669 |
"%s", |
"%s", |
| 670 |
row_pos, col_pos, |
row_pos, col_pos, |
| 671 |
ctx.line_cursor, p_editor_data->display_line_total, |
ctx.line_cursor, p_editor_data->display_line_total, |
| 672 |
key_insert ? "²åÈë" : "¸Äд", |
key_insert ? "²åÈë" : "Ìæ»»", |
| 673 |
ctx.msg); |
ctx.msg); |
| 674 |
|
|
| 675 |
len = split_line(buffer, SCREEN_COLS, &eol, &display_len); |
len = split_line(buffer, SCREEN_COLS, &eol, &display_len, 1); |
| 676 |
for (; display_len < SCREEN_COLS; display_len++) |
for (; display_len < SCREEN_COLS; display_len++) |
| 677 |
{ |
{ |
| 678 |
buffer[len++] = ' '; |
buffer[len++] = ' '; |
| 686 |
moveto((int)row_pos, (int)col_pos); |
moveto((int)row_pos, (int)col_pos); |
| 687 |
iflush(); |
iflush(); |
| 688 |
|
|
| 689 |
|
str_len = 0; |
| 690 |
input_ok = 0; |
input_ok = 0; |
| 691 |
|
ch = igetch_t(MAX_DELAY_TIME); |
| 692 |
while (!SYS_server_exit && !input_ok) |
while (!SYS_server_exit && !input_ok) |
| 693 |
{ |
{ |
|
ch = igetch_t(MAX_DELAY_TIME); |
|
|
input_ok = 1; |
|
|
|
|
| 694 |
// extended key handler |
// extended key handler |
| 695 |
if (editor_display_key_handler(&ch, &ctx) != 0) |
if (editor_display_key_handler(&ch, &ctx) != 0) |
| 696 |
{ |
{ |
| 702 |
input_str[str_len] = (char)(ch - 256); |
input_str[str_len] = (char)(ch - 256); |
| 703 |
str_len++; |
str_len++; |
| 704 |
} |
} |
| 705 |
else |
else if (str_len > 0) |
| 706 |
{ |
{ |
| 707 |
|
log_error("Received %d character over 127 followed by character less than 127\n", str_len); |
| 708 |
str_len = 0; |
str_len = 0; |
| 709 |
} |
} |
| 710 |
|
|
| 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 |
if (str_len == 0) |
BBS_last_access_tm = time(NULL); |
| 715 |
|
|
| 716 |
|
if (str_len == 0) // ch >= 32 && ch < 127 |
| 717 |
{ |
{ |
| 718 |
input_str[0] = (char)ch; |
input_str[0] = (char)ch; |
| 719 |
str_len = 1; |
str_len = 1; |
| 727 |
|
|
| 728 |
if (!key_insert) // overwrite |
if (!key_insert) // overwrite |
| 729 |
{ |
{ |
| 730 |
if (editor_data_delete(p_editor_data, display_line_in, offset_in, |
if (editor_data_delete(p_editor_data, &display_line_out, &offset_out, |
| 731 |
&last_updated_line) < 0) |
&last_updated_line) < 0) |
| 732 |
{ |
{ |
| 733 |
log_error("editor_data_delete() error\n"); |
log_error("editor_data_delete() error\n"); |
| 738 |
input_str, str_len, &last_updated_line) < 0) |
input_str, str_len, &last_updated_line) < 0) |
| 739 |
{ |
{ |
| 740 |
log_error("editor_data_insert(str_len=%d) error\n", str_len); |
log_error("editor_data_insert(str_len=%d) error\n", str_len); |
|
str_len = 0; |
|
| 741 |
} |
} |
| 742 |
else |
else |
| 743 |
{ |
{ |
|
str_len = 0; |
|
|
|
|
| 744 |
output_end_row = MIN(SCREEN_ROWS - 1, output_current_row + (int)(last_updated_line - line_current)); |
output_end_row = MIN(SCREEN_ROWS - 1, output_current_row + (int)(last_updated_line - line_current)); |
| 745 |
line_current -= (output_current_row - row_pos); |
line_current -= (output_current_row - row_pos); |
| 746 |
output_current_row = (int)row_pos; |
output_current_row = (int)row_pos; |
| 768 |
{ |
{ |
| 769 |
row_pos += (display_line_out - display_line_in); |
row_pos += (display_line_out - display_line_in); |
| 770 |
} |
} |
| 771 |
col_pos = offset_out + 1; |
col_pos = offset_out + 1; // Set col_pos to accurate pos |
| 772 |
|
} |
| 773 |
|
|
| 774 |
|
if (display_line_out != display_line_in) // Output on line change |
| 775 |
|
{ |
| 776 |
|
break; |
| 777 |
|
} |
| 778 |
|
|
| 779 |
|
ch = igetch(0); |
| 780 |
|
if (ch == KEY_NULL || ch == KEY_TIMEOUT) // Output if no futher input |
| 781 |
|
{ |
| 782 |
|
break; |
| 783 |
} |
} |
| 784 |
|
|
| 785 |
|
str_len = 0; |
| 786 |
continue; |
continue; |
| 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(NULL); |
| 791 |
|
|
| 792 |
if (ch == BACKSPACE) |
if (ch == BACKSPACE) |
| 793 |
{ |
{ |
| 794 |
if (line_current - output_current_row + row_pos <= 0 && col_pos <= 1) // Forbidden |
if (line_current - output_current_row + row_pos <= 0 && col_pos <= 1) // Forbidden |
| 795 |
{ |
{ |
| 796 |
input_ok = 0; |
ch = igetch_t(MAX_DELAY_TIME); |
| 797 |
continue; |
continue; |
| 798 |
} |
} |
| 799 |
|
|
| 800 |
col_pos--; |
col_pos--; |
| 801 |
|
if (col_pos > 1 && |
| 802 |
|
p_editor_data->p_display_lines[line_current - output_current_row + row_pos][col_pos - 1] < 0) // GBK |
| 803 |
|
{ |
| 804 |
|
col_pos--; |
| 805 |
|
} |
| 806 |
|
|
| 807 |
if (col_pos < 1 && line_current - output_current_row + row_pos >= 0) |
if (col_pos < 1 && line_current - output_current_row + row_pos >= 0) |
| 808 |
{ |
{ |
| 809 |
row_pos--; |
row_pos--; |
| 811 |
} |
} |
| 812 |
} |
} |
| 813 |
|
|
| 814 |
if ((str_len = editor_data_delete(p_editor_data, line_current - output_current_row + row_pos, col_pos - 1, |
display_line_in = line_current - output_current_row + row_pos; |
| 815 |
|
offset_in = col_pos - 1; |
| 816 |
|
display_line_out = display_line_in; |
| 817 |
|
offset_out = offset_in; |
| 818 |
|
|
| 819 |
|
if ((str_len = editor_data_delete(p_editor_data, &display_line_out, &offset_out, |
| 820 |
&last_updated_line)) < 0) |
&last_updated_line)) < 0) |
| 821 |
{ |
{ |
| 822 |
log_error("editor_data_delete() error\n"); |
log_error("editor_data_delete() error\n"); |
| 823 |
} |
} |
| 824 |
else |
else |
| 825 |
{ |
{ |
| 826 |
if (ch == BACKSPACE) |
col_pos = offset_out + 1; // Set col_pos to accurate pos |
|
{ |
|
|
for (i = 1; i < str_len; i++) |
|
|
{ |
|
|
col_pos--; |
|
|
if (col_pos < 1 && line_current - output_current_row + row_pos >= 0) |
|
|
{ |
|
|
row_pos--; |
|
|
col_pos = MAX(1, p_editor_data->display_line_lengths[line_current - output_current_row + row_pos]); |
|
|
} |
|
|
} |
|
|
} |
|
| 827 |
|
|
| 828 |
output_end_row = MIN(SCREEN_ROWS - 1, output_current_row + (int)(last_updated_line - line_current)); |
output_end_row = MIN(SCREEN_ROWS - 1, output_current_row + (int)(last_updated_line - line_current)); |
| 829 |
line_current -= (output_current_row - row_pos); |
line_current -= (output_current_row - row_pos); |
| 852 |
clrline(output_current_row, output_end_row); |
clrline(output_current_row, output_end_row); |
| 853 |
} |
} |
| 854 |
|
|
| 855 |
|
if (display_line_out != display_line_in) // Output on line change |
| 856 |
|
{ |
| 857 |
|
break; |
| 858 |
|
} |
| 859 |
|
|
| 860 |
|
ch = igetch(0); |
| 861 |
|
if (ch == KEY_NULL || ch == KEY_TIMEOUT) // Output if no futher input |
| 862 |
|
{ |
| 863 |
|
break; |
| 864 |
|
} |
| 865 |
|
|
| 866 |
|
str_len = 0; |
| 867 |
continue; |
continue; |
| 868 |
} |
} |
| 869 |
|
|
| 870 |
|
input_ok = 1; |
| 871 |
switch (ch) |
switch (ch) |
| 872 |
{ |
{ |
| 873 |
case KEY_NULL: |
case KEY_NULL: |
| 882 |
break; |
break; |
| 883 |
case Ctrl('E'): // End of line |
case Ctrl('E'): // End of line |
| 884 |
case KEY_CTRL_RIGHT: |
case KEY_CTRL_RIGHT: |
| 885 |
|
if (line_current - output_current_row + row_pos == p_editor_data->display_line_total - 1) // row_pos at end line |
| 886 |
|
{ |
| 887 |
|
// last display line does NOT have \n in the end |
| 888 |
|
col_pos = p_editor_data->display_line_lengths[line_current - output_current_row + row_pos] + 1; |
| 889 |
|
break; |
| 890 |
|
} |
| 891 |
col_pos = MAX(1, p_editor_data->display_line_lengths[line_current - output_current_row + row_pos]); |
col_pos = MAX(1, p_editor_data->display_line_lengths[line_current - output_current_row + row_pos]); |
| 892 |
break; |
break; |
| 893 |
case Ctrl('T'): // Top of screen |
case Ctrl('T'): // Top of screen |
| 948 |
if (col_pos > 1) |
if (col_pos > 1) |
| 949 |
{ |
{ |
| 950 |
col_pos--; |
col_pos--; |
| 951 |
|
if (col_pos > 1 && |
| 952 |
|
p_editor_data->p_display_lines[line_current - output_current_row + row_pos][col_pos - 1] < 0 && |
| 953 |
|
p_editor_data->p_display_lines[line_current - output_current_row + row_pos][col_pos - 2] < 0) // GBK |
| 954 |
|
{ |
| 955 |
|
col_pos--; |
| 956 |
|
} |
| 957 |
break; |
break; |
| 958 |
} |
} |
| 959 |
col_pos = SCREEN_COLS; // continue to KEY_UP |
col_pos = SCREEN_COLS; // continue to KEY_UP |
| 981 |
case KEY_RIGHT: |
case KEY_RIGHT: |
| 982 |
if (col_pos < p_editor_data->display_line_lengths[line_current - output_current_row + row_pos]) |
if (col_pos < p_editor_data->display_line_lengths[line_current - output_current_row + row_pos]) |
| 983 |
{ |
{ |
| 984 |
|
if (p_editor_data->p_display_lines[line_current - output_current_row + row_pos][col_pos - 1] < 0 && |
| 985 |
|
p_editor_data->p_display_lines[line_current - output_current_row + row_pos][col_pos] < 0) // GBK |
| 986 |
|
{ |
| 987 |
|
col_pos++; |
| 988 |
|
} |
| 989 |
col_pos++; |
col_pos++; |
| 990 |
break; |
break; |
| 991 |
} |
} |
| 997 |
col_pos = MIN(col_pos, MAX(1, p_editor_data->display_line_lengths[line_current - output_current_row + row_pos])); |
col_pos = MIN(col_pos, MAX(1, p_editor_data->display_line_lengths[line_current - output_current_row + row_pos])); |
| 998 |
break; |
break; |
| 999 |
} |
} |
| 1000 |
if (line_current + (screen_row_total - (output_current_row - screen_begin_row)) >= p_editor_data->display_line_total) // Reach end |
if (line_current - output_current_row + row_pos == p_editor_data->display_line_total - 1) // row_pos at end line |
| 1001 |
{ |
{ |
| 1002 |
// last display line does NOT have \n in the end |
// last display line does NOT have \n in the end |
| 1003 |
col_pos = p_editor_data->display_line_lengths[line_current - output_current_row + row_pos] + 1; |
col_pos = p_editor_data->display_line_lengths[line_current - output_current_row + row_pos] + 1; |
| 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 |
{ |
{ |
| 1071 |
break; |
break; |
| 1072 |
} |
} |
| 1073 |
|
|
| 1074 |
|
ch = igetch_t(MAX_DELAY_TIME); |
| 1075 |
} |
} |
| 1076 |
|
|
| 1077 |
continue; |
continue; |