| 510 |
long display_line_out, offset_out; |
long display_line_out, offset_out; |
| 511 |
int scroll_rows; |
int scroll_rows; |
| 512 |
long last_updated_line = 0; |
long last_updated_line = 0; |
| 513 |
int insert = 1; |
int key_insert = 1; |
| 514 |
int i; |
int i; |
| 515 |
|
|
| 516 |
screen_current_row = screen_begin_row; |
screen_current_row = screen_begin_row; |
| 531 |
|
|
| 532 |
snprintf(buffer, sizeof(buffer), |
snprintf(buffer, sizeof(buffer), |
| 533 |
"\033[1;44;33m[\033[32m%ld\033[33m;\033[32m%ld\033[33m] " |
"\033[1;44;33m[\033[32m%ld\033[33m;\033[32m%ld\033[33m] " |
| 534 |
"第\033[32m%ld\033[33m/\033[32m%ld\033[33m行 " |
"第\033[32m%ld\033[33m/\033[32m%ld\033[33m行 [\033[32m%s\033[33m] " |
| 535 |
"%s", |
"%s", |
| 536 |
row_pos, col_pos, |
row_pos, col_pos, |
| 537 |
ctx.line_cursor, p_editor_data->display_line_total, |
ctx.line_cursor, p_editor_data->display_line_total, |
| 538 |
|
key_insert ? "插入" : "改写", |
| 539 |
ctx.msg); |
ctx.msg); |
| 540 |
|
|
| 541 |
len = split_line(buffer, SCREEN_COLS, &eol, &display_len); |
len = split_line(buffer, SCREEN_COLS, &eol, &display_len); |
| 588 |
display_line_out = display_line_in; |
display_line_out = display_line_in; |
| 589 |
offset_out = offset_in; |
offset_out = offset_in; |
| 590 |
|
|
| 591 |
|
if (!key_insert) // overwrite |
| 592 |
|
{ |
| 593 |
|
if (editor_data_delete(p_editor_data, display_line_in, offset_in, |
| 594 |
|
&last_updated_line) < 0) |
| 595 |
|
{ |
| 596 |
|
log_error("editor_data_delete() error\n"); |
| 597 |
|
} |
| 598 |
|
} |
| 599 |
|
|
| 600 |
if (editor_data_insert(p_editor_data, &display_line_out, &offset_out, |
if (editor_data_insert(p_editor_data, &display_line_out, &offset_out, |
| 601 |
input_str, str_len, &last_updated_line) < 0) |
input_str, str_len, &last_updated_line) < 0) |
| 602 |
{ |
{ |
| 681 |
col_pos = MIN(col_pos, MAX(1, p_editor_data->display_line_lengths[line_current - screen_current_row + row_pos])); |
col_pos = MIN(col_pos, MAX(1, p_editor_data->display_line_lengths[line_current - screen_current_row + row_pos])); |
| 682 |
break; |
break; |
| 683 |
case KEY_INS: |
case KEY_INS: |
| 684 |
insert = !insert; |
key_insert = !key_insert; |
| 685 |
break; |
break; |
| 686 |
case KEY_HOME: |
case KEY_HOME: |
| 687 |
row_pos = 1; |
row_pos = 1; |