| 23 |
{ |
{ |
| 24 |
EDITOR_MEM_POOL_LINE_PER_CHUNK = 1000, |
EDITOR_MEM_POOL_LINE_PER_CHUNK = 1000, |
| 25 |
EDITOR_MEM_POOL_CHUNK_LIMIT = (MAX_EDITOR_DATA_LINES / EDITOR_MEM_POOL_LINE_PER_CHUNK + 1), |
EDITOR_MEM_POOL_CHUNK_LIMIT = (MAX_EDITOR_DATA_LINES / EDITOR_MEM_POOL_LINE_PER_CHUNK + 1), |
| 26 |
|
TAB_SIZE = 4, |
| 27 |
}; |
}; |
| 28 |
|
|
| 29 |
static const char EDITOR_ESC_DISPLAY_STR[] = "\033[32m*\033[m"; |
static const char EDITOR_ESC_DISPLAY_STR[] = "\033[32m*\033[m"; |
| 78 |
long line_offsets[MAX_EDITOR_DATA_LINES + 1]; |
long line_offsets[MAX_EDITOR_DATA_LINES + 1]; |
| 79 |
long current_data_line_length = 0; |
long current_data_line_length = 0; |
| 80 |
long i; |
long i; |
| 81 |
|
int j; |
| 82 |
|
|
| 83 |
if (p_data == NULL) |
if (p_data == NULL) |
| 84 |
{ |
{ |
| 125 |
memcpy(p_editor_data->p_display_lines[i], p_data + line_offsets[i], (size_t)p_editor_data->display_line_lengths[i]); |
memcpy(p_editor_data->p_display_lines[i], p_data + line_offsets[i], (size_t)p_editor_data->display_line_lengths[i]); |
| 126 |
current_data_line_length += p_editor_data->display_line_lengths[i]; |
current_data_line_length += p_editor_data->display_line_lengths[i]; |
| 127 |
|
|
| 128 |
|
// Convert \t to single space |
| 129 |
|
for (j = 0; j < p_editor_data->display_line_lengths[i]; j++) |
| 130 |
|
{ |
| 131 |
|
if (p_editor_data->p_display_lines[i][j] == '\t') |
| 132 |
|
{ |
| 133 |
|
p_editor_data->p_display_lines[i][j] = ' '; |
| 134 |
|
} |
| 135 |
|
} |
| 136 |
|
|
| 137 |
// Trim \n from last line |
// Trim \n from last line |
| 138 |
if (i + 1 == p_editor_data->display_line_total && |
if (i + 1 == p_editor_data->display_line_total && |
| 139 |
p_editor_data->display_line_lengths[i] > 0 && |
p_editor_data->display_line_lengths[i] > 0 && |
| 680 |
int i, j; |
int i, j; |
| 681 |
char *p_str; |
char *p_str; |
| 682 |
int del_line; |
int del_line; |
| 683 |
|
int tab_width = 0; |
| 684 |
|
|
| 685 |
clrline(output_current_row, SCREEN_ROWS); |
clrline(output_current_row, SCREEN_ROWS); |
| 686 |
|
|
| 719 |
moveto((int)row_pos, (int)col_pos); |
moveto((int)row_pos, (int)col_pos); |
| 720 |
iflush(); |
iflush(); |
| 721 |
|
|
| 722 |
|
tab_width = 0; |
| 723 |
str_len = 0; |
str_len = 0; |
| 724 |
ch = igetch_t(BBS_max_user_idle_time); |
ch = igetch_t(BBS_max_user_idle_time); |
| 725 |
while (!SYS_server_exit) |
while (!SYS_server_exit) |
| 735 |
goto cleanup; |
goto cleanup; |
| 736 |
} |
} |
| 737 |
|
|
| 738 |
|
if (ch == '\t') |
| 739 |
|
{ |
| 740 |
|
ch = ' '; |
| 741 |
|
tab_width = TAB_SIZE - ((int)(col_pos - 1) % TAB_SIZE) - 1; |
| 742 |
|
} |
| 743 |
|
|
| 744 |
if (ch < 256 && (ch & 0x80)) // head of multi-byte character |
if (ch < 256 && (ch & 0x80)) // head of multi-byte character |
| 745 |
{ |
{ |
| 746 |
str_len = 0; |
str_len = 0; |
| 859 |
break; |
break; |
| 860 |
} |
} |
| 861 |
|
|
| 862 |
ch = igetch(0); |
if (ch == ' ' && tab_width > 0) |
|
if (ch == KEY_NULL || ch == KEY_TIMEOUT) // Output if no futher input |
|
| 863 |
{ |
{ |
| 864 |
break; |
tab_width--; |
| 865 |
|
} |
| 866 |
|
else |
| 867 |
|
{ |
| 868 |
|
ch = igetch(0); |
| 869 |
|
if (ch == KEY_NULL || ch == KEY_TIMEOUT) // Output if no futher input |
| 870 |
|
{ |
| 871 |
|
break; |
| 872 |
|
} |
| 873 |
} |
} |
| 874 |
|
|
| 875 |
str_len = 0; |
str_len = 0; |