1 diff --git src/LYStrings.c src/LYStrings.c
2 index 67c0b2b..c34cf30 100644
5 @@ -270,6 +270,40 @@ int fancy_mouse(WINDOW * win, int row,
9 +// ------------------------ >8 ------------------------
13 +#include <sys/stat.h>
14 +#define typecalloc(cast) (cast *)calloc((size_t)1, sizeof(cast))
16 +static char *readEditedFile(char *ed_temp)
18 + struct stat stat_info;
20 + if ((stat(ed_temp, &stat_info) < 0) ||
21 + !S_ISREG(stat_info.st_mode) ||
22 + ((size = (size_t) stat_info.st_size) == 0)) {
25 + char *ebuf = malloc(size + 1);
26 + assert(ebuf != NULL);
28 + if ((fp = fopen(ed_temp, "r")) != 0) {
29 + size = fread(ebuf, (size_t) 1, size, fp);
41 +// ------------------------ >8 ------------------------
44 * Manage the collection of edit-histories
46 @@ -3380,8 +3414,24 @@ int LYDoEdit(FieldEditor * edit, int ch,
50 - case LYE_ERASE: /* erase the line */
53 + char *tmpPath = malloc(LY_MAXPATH);
54 + FILE *fp = LYOpenTemp(tmpPath, "", "w");
58 + edit_temporary_file(tmpPath, "", NULL);
59 + char *ebuf = readEditedFile(tmpPath);
64 + edit->efBufInUse = strlen(ebuf);
65 + edit->efBufAlloc = edit->efBufInUse;
66 + edit->efBufLimit = 0;
70 #ifdef ENHANCED_LINEEDIT
71 EditMark = -1; /* Do not show the mark */