diff options
author | KatolaZ <katolaz@freaknet.org> | 2019-08-01 12:19:22 +0100 |
---|---|---|
committer | KatolaZ <katolaz@freaknet.org> | 2019-08-01 12:19:22 +0100 |
commit | 62713aaf65264950aecad9237d50e911d7dad893 (patch) | |
tree | 5d91079a8d70ae734564ec2dd5e00b107d0d589f /files.c | |
parent | 08485aacd8d561f2650175b7a16211262396b2ce (diff) |
fix bug in undo list allocation
Diffstat (limited to 'files.c')
-rw-r--r-- | files.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -50,8 +50,12 @@ void load_file(FILE *fc){ get_string(fc, "Load file: ", newfname, 255); if ((fin=fopen(newfname, "r")) != NULL){ i = 0; - while((fgets(screen.l[i].s, WIDTH+2, fin)) != NULL && i<HEIGHT) - screen.l[i++].s[WIDTH-1]='\0'; + while((fgets(screen.l[i].s, WIDTH+1, fin)) != NULL && i<HEIGHT){ + screen.l[i].lst = strlen(screen.l[i].s) - 1; + screen.l[i].n = i; + screen.l[i].s[strlen(screen.l[i].s)-1]='\0'; + i++; + } for(;i<HEIGHT; i++){ erase_line(i); } |