summaryrefslogtreecommitdiff
path: root/files.c
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2019-08-01 12:19:22 +0100
committerKatolaZ <katolaz@freaknet.org>2019-08-01 12:19:22 +0100
commit62713aaf65264950aecad9237d50e911d7dad893 (patch)
tree5d91079a8d70ae734564ec2dd5e00b107d0d589f /files.c
parent08485aacd8d561f2650175b7a16211262396b2ce (diff)
fix bug in undo list allocation
Diffstat (limited to 'files.c')
-rw-r--r--files.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/files.c b/files.c
index 245b29b..17743a5 100644
--- a/files.c
+++ b/files.c
@@ -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);
}