| 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 + 1, 0); |
p_editor_data->display_line_total = split_data_lines(p_data, SCREEN_COLS, line_offsets, MAX_EDITOR_DATA_LINES + 1, 0, NULL); |
| 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 |
{ |
{ |
| 274 |
} |
} |
| 275 |
|
|
| 276 |
// Split current data line if over-length |
// Split current data line if over-length |
| 277 |
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) |
| 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 |
{ |
{ |
| 294 |
return -2; |
return -2; |
| 295 |
} |
} |
| 296 |
|
|
| 297 |
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) |
| 298 |
{ |
{ |
| 299 |
if (str[0] == CR) |
if (str[0] == CR) |
| 300 |
{ |
{ |
| 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, 0); |
split_line_total = split_data_lines(p_data_line, SCREEN_COLS, line_offsets, split_line_total, 0, NULL); |
| 366 |
|
|
| 367 |
for (i = 0; i < split_line_total; i++) |
for (i = 0; i < split_line_total; i++) |
| 368 |
{ |
{ |
| 578 |
split_line_total = last_display_line - display_line + 2; |
split_line_total = last_display_line - display_line + 2; |
| 579 |
|
|
| 580 |
// Split current data line since beginning of current display line |
// Split current data line since beginning of current display line |
| 581 |
split_line_total = split_data_lines(p_data_line, SCREEN_COLS, line_offsets, split_line_total, 0); |
split_line_total = split_data_lines(p_data_line, SCREEN_COLS, line_offsets, split_line_total, 0, NULL); |
| 582 |
|
|
| 583 |
for (i = 0; i < split_line_total; i++) |
for (i = 0; i < split_line_total; i++) |
| 584 |
{ |
{ |
| 675 |
return ch; |
return ch; |
| 676 |
} |
} |
| 677 |
|
|
| 678 |
loop = 1; |
for (loop = 1; !SYS_server_exit && loop;) |
|
while (!SYS_server_exit && loop) |
|
| 679 |
{ |
{ |
| 680 |
if (line_current >= p_editor_data->display_line_total || output_current_row > output_end_row) |
if (line_current >= p_editor_data->display_line_total || output_current_row > output_end_row) |
| 681 |
{ |
{ |
| 705 |
iflush(); |
iflush(); |
| 706 |
|
|
| 707 |
str_len = 0; |
str_len = 0; |
|
input_ok = 0; |
|
| 708 |
ch = igetch_t(MAX_DELAY_TIME); |
ch = igetch_t(MAX_DELAY_TIME); |
| 709 |
while (!SYS_server_exit && !input_ok) |
while (!SYS_server_exit) |
| 710 |
{ |
{ |
| 711 |
// extended key handler |
// extended key handler |
| 712 |
if (editor_display_key_handler(&ch, &ctx) != 0) |
if (editor_display_key_handler(&ch, &ctx) != 0) |
| 771 |
clrtoeol(); |
clrtoeol(); |
| 772 |
for (i = 0; i < scroll_rows; i++) |
for (i = 0; i < scroll_rows; i++) |
| 773 |
{ |
{ |
| 774 |
prints("\033[S"); // Scroll up 1 line |
// prints("\033[S"); // Scroll up 1 line |
| 775 |
|
prints("\n"); // Legacy Cterm only works with this line |
| 776 |
} |
} |
| 777 |
|
|
| 778 |
output_current_row -= scroll_rows; |
output_current_row -= scroll_rows; |
| 812 |
{ |
{ |
| 813 |
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 |
| 814 |
{ |
{ |
| 815 |
ch = igetch_t(MAX_DELAY_TIME); |
break; // force output prior operation result if any |
|
continue; |
|
| 816 |
} |
} |
| 817 |
|
|
| 818 |
col_pos--; |
col_pos--; |
| 1027 |
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])); |
| 1028 |
moveto(SCREEN_ROWS, 0); |
moveto(SCREEN_ROWS, 0); |
| 1029 |
clrtoeol(); |
clrtoeol(); |
| 1030 |
prints("\033[S"); // Scroll up 1 line |
// prints("\033[S"); // Scroll up 1 line |
| 1031 |
|
prints("\n"); // Legacy Cterm only works with this line |
| 1032 |
break; |
break; |
| 1033 |
case KEY_PGUP: |
case KEY_PGUP: |
| 1034 |
if (line_current - output_current_row < 0) // Reach begin |
if (line_current - output_current_row < 0) // Reach begin |