| 169 |
// Get accurate offset of first character of CJK at offset position |
// Get accurate offset of first character of CJK at offset position |
| 170 |
for (i = 0; i < offset; i++) |
for (i = 0; i < offset; i++) |
| 171 |
{ |
{ |
| 172 |
if (p_editor_data->p_display_lines[display_line][i] < 0) // GBK |
if (p_editor_data->p_display_lines[display_line][i] < 0 || p_editor_data->p_display_lines[display_line][i] > 127) // GBK |
| 173 |
{ |
{ |
| 174 |
i++; |
i++; |
| 175 |
} |
} |
| 368 |
// Get accurate offset of first character of CJK at offset position |
// Get accurate offset of first character of CJK at offset position |
| 369 |
for (i = 0; i < offset; i++) |
for (i = 0; i < offset; i++) |
| 370 |
{ |
{ |
| 371 |
if (p_editor_data->p_display_lines[display_line][i] < 0) // GBK |
if (p_editor_data->p_display_lines[display_line][i] < 0 || p_editor_data->p_display_lines[display_line][i] > 127) // GBK |
| 372 |
{ |
{ |
| 373 |
i++; |
i++; |
| 374 |
} |
} |
| 417 |
} |
} |
| 418 |
else |
else |
| 419 |
{ |
{ |
| 420 |
log_error("Some strange character at display_line %ld, offset %ld\n", display_line, offset); |
log_error("Some strange character at display_line %ld, offset %ld: %d %d %d %d\n", |
| 421 |
return -2; |
display_line, offset, p_data_line[offset_data_line], p_data_line[offset_data_line + 1], |
| 422 |
|
p_data_line[offset_data_line + 2], p_data_line[offset_data_line + 3]); |
| 423 |
|
str_len = 1; |
| 424 |
} |
} |
| 425 |
|
|
| 426 |
// Current display line is (almost) empty |
// Current display line is (almost) empty |
| 588 |
iflush(); |
iflush(); |
| 589 |
|
|
| 590 |
input_ok = 0; |
input_ok = 0; |
| 591 |
|
ch = igetch_t(MAX_DELAY_TIME); |
| 592 |
while (!SYS_server_exit && !input_ok) |
while (!SYS_server_exit && !input_ok) |
| 593 |
{ |
{ |
|
ch = igetch_t(MAX_DELAY_TIME); |
|
|
input_ok = 1; |
|
|
|
|
| 594 |
// extended key handler |
// extended key handler |
| 595 |
if (editor_display_key_handler(&ch, &ctx) != 0) |
if (editor_display_key_handler(&ch, &ctx) != 0) |
| 596 |
{ |
{ |
| 668 |
row_pos += (display_line_out - display_line_in); |
row_pos += (display_line_out - display_line_in); |
| 669 |
} |
} |
| 670 |
col_pos = offset_out + 1; |
col_pos = offset_out + 1; |
| 671 |
|
} |
| 672 |
|
|
| 673 |
continue; |
// Check whether there is additional input |
| 674 |
|
ch = igetch(0); |
| 675 |
|
if (ch == KEY_TIMEOUT) |
| 676 |
|
{ |
| 677 |
|
input_ok = 1; |
| 678 |
} |
} |
| 679 |
|
continue; |
| 680 |
} |
} |
| 681 |
else if (ch == KEY_DEL || ch == BACKSPACE) // Del |
else if (ch == KEY_DEL || ch == BACKSPACE) // Del |
| 682 |
{ |
{ |
| 722 |
} |
} |
| 723 |
} |
} |
| 724 |
|
|
| 725 |
|
// Check whether there is additional input |
| 726 |
|
ch = igetch(0); |
| 727 |
|
if (ch == KEY_TIMEOUT) |
| 728 |
|
{ |
| 729 |
|
input_ok = 1; |
| 730 |
|
} |
| 731 |
continue; |
continue; |
| 732 |
} |
} |
| 733 |
|
|
| 734 |
|
input_ok = 1; |
| 735 |
switch (ch) |
switch (ch) |
| 736 |
{ |
{ |
| 737 |
case KEY_NULL: |
case KEY_NULL: |
| 894 |
} |
} |
| 895 |
|
|
| 896 |
BBS_last_access_tm = time(0); |
BBS_last_access_tm = time(0); |
| 897 |
|
if (!input_ok) |
| 898 |
|
{ |
| 899 |
|
ch = igetch_t(MAX_DELAY_TIME); |
| 900 |
|
} |
| 901 |
} |
} |
| 902 |
|
|
| 903 |
continue; |
continue; |