| 426 |
break; |
break; |
| 427 |
case KEY_F2: // For test only |
case KEY_F2: // For test only |
| 428 |
EDITOR_DATA *p_editor_data; |
EDITOR_DATA *p_editor_data; |
| 429 |
size_t data_new_len = strlen(p_data) + 1; |
// size_t data_new_len = strlen(p_data) + LINE_BUFFER_LEN; |
| 430 |
|
|
| 431 |
char *p_data_new = malloc(data_new_len); |
// char *p_data_new = malloc(data_new_len); |
| 432 |
if (p_data_new == NULL) |
// if (p_data_new == NULL) |
| 433 |
{ |
// { |
| 434 |
break; |
// break; |
| 435 |
} |
// } |
| 436 |
p_editor_data = editor_data_load(p_data); |
p_editor_data = editor_data_load(p_data); |
| 437 |
if (p_editor_data == NULL) |
if (p_editor_data == NULL) |
| 438 |
{ |
{ |
| 439 |
free(p_data_new); |
// free(p_data_new); |
| 440 |
break; |
break; |
| 441 |
} |
} |
| 442 |
|
|
| 443 |
editor_display(p_editor_data); |
editor_display(p_editor_data); |
| 444 |
editor_data_save(p_editor_data, p_data_new, data_new_len); |
// editor_data_save(p_editor_data, p_data_new, data_new_len); |
|
|
|
|
if (strcmp(p_data, p_data_new) != 0) |
|
|
{ |
|
|
log_error("Data was changed\n"); |
|
|
} |
|
|
|
|
| 445 |
editor_data_cleanup(p_editor_data); |
editor_data_cleanup(p_editor_data); |
| 446 |
p_editor_data = NULL; |
p_editor_data = NULL; |
| 447 |
free(p_data_new); |
// free(p_data_new); |
| 448 |
p_data_new = NULL; |
// p_data_new = NULL; |
| 449 |
|
|
| 450 |
// Refresh after display editor |
// Refresh after display editor |
| 451 |
line_current -= (screen_current_line - screen_begin_line); |
line_current -= (screen_current_line - screen_begin_line); |